有没有一种简单的方法"关闭日志"之前释放市场上的应用程序?应用程序、简单、方法、市场

2023-09-05 03:29:43 作者:魂不附体

我是preparing发布在市场上的应用程序,阅读的谷歌文档的位于此处它提出以下建议:停用任何呼叫日志中的源$ C ​​$ C方法

有一个不必经过我的所有的源文件,并手动删除每一行更简单的方法?

另外,为什么删除记录,它是一个资源猪?

解决方案

您可以通过的 ProGuard的。在最新的SDK和工具ProGuard的配置文件应该已经存在。克里斯托弗在类似的问题回答了这个。

  

最简单的方法可能是在部署之前通过ProGuard的运行编译的JAR,有一个配置,如:

  -assumenosideeffects类android.util.Log {
  公共静态INT V(...);
}
 

  

将 - 除了其他所有的ProGuard的优化 - 直接从字节code删除任何详细的日志报表

怎样用word2003把四行文字内容用一个四行四列的表格进行呈现,有没有简单的方法

您可以决定要禁用哪些logoutputs通过添加

  -assumenosideeffects类android.util.Log {
  公共静态INT D(...);
  公共静态INT I(...);
  公共静态INT E(...);
}
 

要ProGuard的配置文件中。我喜欢保持.E消息在我的code,因为那些只在部分捕获部分使用所需的应用程序的正常执行过程中降低性能比较。

I'm preparing to release an app on the market place, on reading the Google documentation located here it suggests the following : Deactivate any calls to Log methods in the source code.

Is there an easier way than having to go through all my source files and remove each line manually?

Also, why remove the logging, is it a resource hog?

解决方案

You can do this through proguard. In the latest SDK and tools a proguard configuration file should already exist. Christopher answered this in a similar question.

The easiest way is probably to run your compiled JAR through ProGuard before deployment, with a config like:

-assumenosideeffects class android.util.Log {
  public static int v(...);
}

That will — aside from all the other ProGuard optimisations — remove any verbose log statements directly from the bytecode.

You can decide which logoutputs you want to disable through adding

-assumenosideeffects class android.util.Log {
  public static int d(...);
  public static int i(...);
  public static int e(...);
}

to the proguard config file as well. I like to keep the .e Messages in my code because those are only used in some catch parts want decrease perfomance during the normal execution of the application.