Android how to place all my classes in one package using Proguard -
i developing sdk, environment got sdk library , testing project use it.
i want protect library code library users , there need obfuscate it, it.
so in android studio in library module, in proguard-rules.pro file added next script:
-dontpreverify -optimizations !code/simplification/arithmetic -keep class !com.example.**{ *; } -keep public class com.example.sdk.example{*;} -keep public class com.example.sdk.iexamplecallback{*;} -keep public class com.example.sdk.ui.exampleactivity -dontwarn android.util.log -repackageclasses 'com.example.security' -allowaccessmodification
the classes obfuscated package not changed. fallowed eric lafortune(the author of proguard) suggestion add allowaccessmodification
, didn't helped. try using flattenpackagehierarchy
, had no effect.
help me, how place classes in 1 package?
solved it: after adding lines did job
-useuniqueclassmembernames -keeppackagenames donotkeepathing
this full script
-optimizationpasses 30 -mergeinterfacesaggressively -dontpreverify -optimizations !code/simplification/arithmetic -repackageclasses 'com.example' -allowaccessmodification -useuniqueclassmembernames -keeppackagenames donotkeepathing -keep class !com.example.**{ *; } -keep public class com.sdk.example{ *; } -keep public class com.sdk.iexamplecallback{ *; } -keepclasseswithmembernames public class com.sdk.ui.activity.exampleactivity{ public <methods>; protected <methods>; } -keepclasseswithmembernames public class com.example.sdk.examplereciever{ public <methods>; } -assumenosideeffects class android.util.log { public static boolean isloggable(java.lang.string, int); public static int v(...); public static int i(...); public static int w(...); public static int d(...); public static int e(...); }
Comments
Post a Comment