正确的Proguard配置可保持静态内部类 [英] Proper Proguard configuration to keep static inner class

查看:413
本文介绍了正确的Proguard配置可保持静态内部类的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有以下内容:

public class A extends B {
    static class C {
        Object field1;
        int field2;
        boolean field3;
    }
}

无法通过反射获取C类!

我尝试了以下操作:

-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?

也许值得一提的是B扩展了View ...

Perhaps its worth mentioning that B extends View...

推荐答案

所有这些都应该起作用(仅Object-> java.lang.Object).您可以检查bin/proguard/seeds.txt以查看是否列出了它们.否则,您可能修改了错误的配置文件,或者名称中可能有错字.

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.

这篇关于正确的Proguard配置可保持静态内部类的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆