启用Proguard时,我遇到Jackson和Kotlin数据类的问题。 杰克逊版本:2.9.1 杰克逊转换器版本:2.3.0 Kotlin版本:1.2.51
这是我的保护文件:
-ignorewarnings
# Jackson 2.x
-keepclassmembers class com.jgarin.remote.models.** {
<init>(...);
<fields>;
}
-keepclassmembers class * {
@com.fasterxml.jackson.annotation.JsonCreator *;
@com.fasterxml.jackson.annotation.JsonProperty *;
}
#Required for Kotlin!
-keep class kotlin.Metadata { *; }
-keep class kotlin.reflect.** { *; }
-keepclassmembers public class com.jgarin.** {
public synthetic <methods>;
}
-keepattributes SourceFile,LineNumberTable,*Annotation*,EnclosingMethod,Signature,Exceptions,InnerClasses
仍然,该应用程序失败,并引发异常:
E/RxCallAdapterWrapper: Retrofit exception occurred
com.fasterxml.jackson.databind.exc.MismatchedInputException: Cannot construct instance of `com.jgarin.remote.models.responses.GetVerificationCodeResponse` (although at least one Creator exists): cannot deserialize from Object value (no delegate- or property-based Creator)
其余的堆栈跟踪几乎没有用。我很确定我缺少明显的东西。任何帮助表示赞赏。谢谢。