开发者

Is there an easy way to "deactivate logging" prior to releasing your app on the market?

开发者 https://www.devze.com 2023-02-14 01:55 出处:网络
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 cod开发者_开发问答e

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 cod开发者_开发问答e.

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.


Have a look at this question:

  • Deactivate any calls to Log before publishing: are there tools to do this?
0

精彩评论

暂无评论...
验证码 换一张
取 消