My android program has a class A
, which has two static inner class
. They are found to be stripped from .dex
after applying proguard.
public class A{ ... static class B{ ... } static class C{ ... } }
I have put the following lines in proguard.flags, but seem no luck.
-keep class com.xxx.A -keep class com.xxx.A$*
Any hint?
-keepclassmembernames. This is the most permissive keep directive; it lets ProGuard do almost all of its work. Unused classes are removed, the remaining classes are renamed, unused members of those classes are removed, but then the remaining members keep their original names.
ProGuard Facts:Helps to remove unused classes, members & fields. It removes unused codes from your libraries as well. (Which means, any method or field that is not referenced anywhere will be removed by ProGuard Shrinker). Helps to reduce the build size by obfuscating the classes, methods, & fields with short names.
If your code works fine without the missing classes, you can suppress the warnings with '-dontwarn' options. ( http://proguard.sourceforge.net/manual/troubleshooting.html#unresolvedclass) Warning: there were 2 unresolved references to program class members. Your input classes appear to be inconsistent.
The getDefaultProguardFile() refers default file “proguard-android. txt” which gets from the Android SDK tools/proguard/ folder. You can also use “proguard-android-optimize. txt” file for more code shrinking located on the same folder.
Try adding InnerClasses
to the keep attributes. e.g:
-keepattributes Exceptions, InnerClasses, ...
Also, try adding a body to the "keep" call with an asterisk, like so:
-keep class com.xxx.A$* { *; }
This is what I had to do for my config
-keep class com.xxx.A { *; } -keep class com.xxx.A$B { *; } -keep class com.xxx.A$C { *; }
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With