启用minifyenabled时出现致命异常assertionerror(gson 2.8.6):java.lang.nosuchfieldexception:

ebdffaop  于 2021-08-25  发布在  Java
关注(0)|答案(0)|浏览(438)

我收到运行时异常:由以下原因引起:java.lang.assertionerror:assertionerror(gson 2.8.6):java.lang.nosuchfieldexception:blf
启用Minify并对roomdb使用类型转换时。它在库和梯度更新后聚焦

public class Converter {
...

    @TypeConverter
    public static List<MPK> toMpkList(String value) {
        Type listType = new TypeToken<List<MPK>>() {}.getType();
        return new Gson().fromJson(value, listType);
    }
...
}

我的班级到conver:

public class MPK implements Comparable<MPK>, Serializable {
    private String mLabel;
    private TypeMPK mType;
    private String mValue;
    private DialogState dialogState;
    private DialogStateDirection stateDirection;

    public int index = -1;

    //Constructor setter getters, compareTo, equals
    ...

}

我的枚举:

public enum TypeMPK implements Serializable {
    @SerializedName("Blf")
    Blf,
    @SerializedName("SpeedDial")
    SpeedDial,
    @SerializedName("None")
    None
}

我的proguard-rules.pro文件:

-dontwarn org.apache.**
-dontwarn com.google.android.gms.iid.**

# Gson specific classes

-keep class {com.my.package}.mpk.**{ *; }

-keepclassmembers enum {com.my.package}.**{ *; }

-keepclassmembers enum * { *; }
-keepclassmembers class * { *; }

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题