【发布时间】:2016-05-02 02:48:39
【问题描述】:
这是我的实体类:
class Entity{
private String id;
Object content;
private Type type;
public enum Type{type1, type2, type3}
}
根据type 字段,我将相应的类传递给
gson.fromJson(json, <type1/2/3 class, depending on field type>);
但我正在使用 proguard,这会混淆类型值,所以我无法确定要使用哪个类。
我试图保留类型字段,但它没有保留。这是我的代码:
-keepclassmembers enum * { *; }
-keepclassmembers class com.mypkg.Entity {
private java.lang.String id;
private com.mypkg.Entity.Type type;
}
我看到保留了 id,但没有保留 type 字段。
请帮忙。
【问题讨论】:
标签: android enums gson proguard android-proguard