Guy Guy - 25 days ago 9
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 com.google.** {*;}
-keepclassmembers interface com.google.** {*;}


Is there a way to whitelist only my package name?

com.dht.github.myApp

Answer

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

-keep class com.google.** {*;}

-keep interface com.google.** {*;}

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

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

Comments