Proper Proguard configuration to keep static inner class

倖福魔咒の 提交于 2019-12-23 08:55:14

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!