android–ProGuard–org.codehaus.jackson.map.JsonMappingException:没有为类型找到合适的构造函数

android–ProGuard–org.codehaus.jackson.map.JsonMappingException:没有为类型找到合适的构造函数,第1张

概述我有一个基于Android的应用程序,它使用Rest服务连接到Google App Engine,该应用程序完美运行,直到它在发布之前通过ProGuard进行模糊处理.运行混淆应用程序时LogCat中报告的错误是:Unable to convert a [application/json,UTF-8] representation into an objec

我有一个基于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.WasteCollectionAreasContainerorg.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?)

我在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.**

而我的班级错误指的是:

public class WasteCollectionAreasContainer { public List

要在通过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?)

表明Jackson库试图使用反射来反序列化你的类,它的原始名称和带注释的构造函数. ProGuard无法预见到这一点,因此它可能已删除或重命名了该类及其构造函数.您可能需要明确地保留它们:

-keep class com.enterprisemk.androID.bcw.bincollection.WasteCollectionAreasContainer {    

出于同样的原因,可能还需要保留其他类似的类/字段/方法. 总结

以上是内存溢出为你收集整理的android – ProGuard – org.codehaus.jackson.map.JsonMappingException:没有为类型找到合适的构造函数全部内容,希望文章能够帮你解决android – ProGuard – org.codehaus.jackson.map.JsonMappingException:没有为类型找到合适的构造函数所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/web/1140222.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-31
下一篇 2022-05-31

发表评论

登录后才能评论

评论列表(0条)