Guy Guy -4 years ago 111
Java Question

Setting ProGuard to obfuscate only my app's package

Trying to obfuscate using ProGuard but getting 3rd party libraries errors, so I'm excluding each package one by one:

-keepclassmembers class android.** {*;}
-keepclassmembers interface android.** {*;}

-keepclassmembers class** {*;}
-keepclassmembers interface** {*;}

Is there a way to whitelist only my package name?


Answer Source

According to your code you are just keeping class members not whole class. Use this to keep class as it is.

-keep class** {*;}

-keep interface** {*;}

You also can use this line to only obfuscate your own classes and accept everything else.

-keep class !com.yourpackage.**,!com.youranotherpackage.** { *; }

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download