Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

like image 453
Guy Avatar asked Feb 06 '23 22:02

Guy


1 Answers

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 keep everything else.

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

like image 184
Gopal Singh Sirvi Avatar answered Feb 11 '23 14:02

Gopal Singh Sirvi