Iai*_*KER 5 android restlet proguard
我有一个基于Android的应用程序,它使用Rest服务连接到Google App Engine,该应用程序完美运行,直到它在发布之前通过ProGuard进行模糊处理.
运行混淆应用程序时LogCat中报告的错误是:
Unable to convert a [application/json,UTF-8] representation into an object of
class com.enterprisemk.android.bcw.bincollection.WasteCollectionAreasContainer
org.codehaus.jackson.map.JsonMappingException: No suitable constructor found
for type [simple type, class
com.enterprisemk.android.bcw.bincollection.WasteCollectionAreasContainer]:
can not instantiate from JSON object (need to add/enable type information?)
Run Code Online (Sandbox Code Playgroud)
我在proguard-project.txt文件中有以下内容:
-keepattributes *Annotation*,EnclosingMethod
-keep public class org.w3c.** {public private protected *;}
-dontwarn org.w3c.**
-keep public class org.joda.time.** {public private protected *;}
-dontwarn org.joda.time.**
-keep public class org.restlet.** { *; }
-dontwarn org.restlet.**
-keep public class org.codehaus.** { *; }
-dontwarn org.codehaus.**
-keepattributes Signature
-keepnames class com.fasterxml.jackson.** { *; }
-dontwarn com.fasterxml.jackson.databind.**
Run Code Online (Sandbox Code Playgroud)
而我的班级错误指的是:
public class WasteCollectionAreasContainer {
public List<WasteCollectionAreas> wasteCollectionAreasList;
public List<WasteCollectionAreas> getWasteCollectionAreasList() {
return wasteCollectionAreasList;
}
public void setWasteCollectionAreasist(List<WasteCollectionAreas> wasteCollectionAreasList) {
this.wasteCollectionAreasList = wasteCollectionAreasList;
}
public WasteCollectionAreasContainer() {
wasteCollectionAreasList = new ArrayList<WasteCollectionAreas>();
}
@JsonCreator
public WasteCollectionAreasContainer(List<WasteCollectionAreas> wasteCollectionAreasList) {
this.wasteCollectionAreasList = wasteCollectionAreasList;
}
}
Run Code Online (Sandbox Code Playgroud)
要在通过ProGuard进行模糊处理之前重申该应用程序可以完美运行.
任何人都可以帮我解决这个问题吗?
错误信息
org.codehaus.jackson.map.JsonMappingException: No suitable constructor found for type
[simple type, class com.enterprisemk.android.bcw.bincollection.WasteCollectionAreasContainer]:
can not instantiate from JSON object (need to add/enable type information?)
Run Code Online (Sandbox Code Playgroud)
表明 Jackson 库正在尝试使用反射反序列化您的类,及其原始名称和带注释的构造函数。ProGuard 无法预见这一点,因此它可能已删除或重命名该类及其构造函数。您可能需要显式保留它们:
-keep class com.enterprisemk.android.bcw.bincollection.WasteCollectionAreasContainer {
<init>(java.util.List);
}
Run Code Online (Sandbox Code Playgroud)
出于同样的原因,可能还有其他类似的类/字段/方法需要保留。
| 归档时间: |
|
| 查看次数: |
2450 次 |
| 最近记录: |