使用Proguard时使用jackson-json库的问题

时间:2012-06-14 08:59:36

标签: android obfuscation jackson proguard

我在Android项目中使用jackson-json库,在使用Proguard进行混淆时导出应用程序时,出现以下错误:

Proguard returned with error code 1. See console
Warning: com.fasterxml.jackson.databind.ext.DOMSerializer: can't find referenced class org.w3c.dom.bootstrap.DOMImplementationRegistry
Warning: com.fasterxml.jackson.databind.ext.DOMSerializer: can't find referenced class org.w3c.dom.bootstrap.DOMImplementationRegistry
Warning: com.fasterxml.jackson.databind.ext.DOMSerializer: can't find referenced class org.w3c.dom.bootstrap.DOMImplementationRegistry
Warning: com.fasterxml.jackson.databind.ext.DOMSerializer: can't find referenced class org.w3c.dom.bootstrap.DOMImplementationRegistry
Warning: com.fasterxml.jackson.databind.ext.DOMSerializer: can't find referenced class org.w3c.dom.bootstrap.DOMImplementationRegistry
You should check if you need to specify additional program jars.
Warning: there were 5 unresolved references to classes or interfaces.
You may need to specify additional library jars (using '-libraryjars').
java.io.IOException: Please correct the above warnings first.
at proguard.Initializer.execute(Initializer.java:321)
at proguard.ProGuard.initialize(ProGuard.java:211)
at proguard.ProGuard.execute(ProGuard.java:86)
at proguard.ProGuard.main(ProGuard.java:492)

我尝试使用项目的设置,添加“-libraryjars”以包含其他jar,以及许多其他内容,但没有任何帮助。

1 个答案:

答案 0 :(得分:37)

好的,我已经添加了我从多个网站收集的下一些内容:

-libraryjars libs/jackson-annotations-2.0.0.jar
-libraryjars libs/jackson-core-2.0.0.jar

-dontskipnonpubliclibraryclassmembers

-keepattributes *Annotation*,EnclosingMethod

-keepnames class org.codehaus.jackson.** { *; }

-dontwarn javax.xml.**
-dontwarn javax.xml.stream.events.**
-dontwarn com.fasterxml.jackson.databind.**

以及用于json的每个类的下一个代码(使用get& set),我认为apk正在创建但我不确定我写的是否足以制作它运作良好,如果不需要我写的一些东西:

-keep public class MyClass.** {
  public void set*(***);
  public *** get*();
}