开发者

proguard.cfg not working in exported application using LIBRARY

I have two versions of the same application using identical proguard.cfg with the following section aimed at squelching all Log.x() LogCat output:

-assumenos开发者_StackOverflowideeffects class android.util.Log {
    public static *** v(...);
    public static *** i(...);
    public static *** d(...);
    public static *** w(...);
    public static *** e(...);
}

The first version is monolithic (i.e. not referencing any Library projects whatsoever) and proguard.cfg works there exactly as expected.

The second version is using two Library projects (one is mine and the other is Google's LVL). The same proguard.cfg is placed in both the application project and my Library project. However, in that second version, proguard.cfg seems to simply have no effect!

What could possibly explain this?


You did add proguard.config=proguard.cfg to build.properties in your application project? You should see ProGuard's console messages and output files. The optimization pass should at least mention some "Number of removed instructions".

The application classes and the library classes are all compiled to bin/classes. They are then treated exactly the same: they are combined into bin/original.jar and obfuscated to bin/obfuscated.jar, using proguard.cfg. Adding more classes can't really have an effect on removing the logging code.


Please use this switch to diagnose: -whyareyoukeeping


To disable logging in my app, I used this:

-assumenosideeffects public class android.util.Log {
    <methods>;
}

If that doesn't solve your problem then there are a couple other things to try:

  1. Throw an exception at a part of the code proguard should be obfuscating. If the stacktrace is not obfuscated, then proguard might not be running properly.
  2. Your app cannot have debug enabled when you do a proguard build. Be sure that in your manifest, the <application> element is set to android:debuggable="false"
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜