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

and*_*per 15 obfuscation android proguard jackson

我在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)
Run Code Online (Sandbox Code Playgroud)

我试图使用项目的设置,添加"-libraryjars"以包括其他罐子,以及许多其他东西,但没有任何帮助.

and*_*per 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.**
Run Code Online (Sandbox Code Playgroud)

连同用于json的每个类的下一个代码(使用get&set),我认为apk正在创建,但我不确定我写的是否足以使其工作良好,并且如果一些我写的不是必需的:

-keep public class MyClass.** {
  public void set*(***);
  public *** get*();
}
Run Code Online (Sandbox Code Playgroud)

  • 很好...这没有任何问题. (2认同)