16

我在 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 和许多其他东西,但没有任何帮助。

4

1 回答 1

39

好的,我添加了从多个网站收集的以下内容:

-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*();
}
于 2012-06-14T12:14:57.243 回答