问题
I have the following:
public class A extends B {
static class C {
Object field1;
int field2;
boolean field3;
}
}
I cannot get the C class via reflection!
I've tried the following:
-keep class com.path.to._class.A$** {*;}
-keep class com.path.to._class.A$* {*;}
-keep class com.path.to._class.A$C {*;}
-keep class com.path.to._class.A$C {
<fields>;
}
-keep class com.path.to._class.A$C {
Object field1;
int field2;
boolean field3;
}
None of the above worked. Am I doing something completely wrong here?
Perhaps its worth mentioning that B extends View...
回答1:
All of those should work (only Object -> java.lang.Object). You can check bin/proguard/seeds.txt to see if they are listed. Otherwise, you might be modifying the wrong configuration file, or there might be a typo in the names.
回答2:
-keep public class com.path.to._class.A$C {*;}
This is working for me, posting very late but still may help others facing this issue
来源:https://stackoverflow.com/questions/19368053/proper-proguard-configuration-to-keep-static-inner-class