Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Problems with using jackson-json library when using Proguard

I'm using the jackson-json library in an Android project, and when exporting the app while using Proguard for obfuscation, I get the following errors:

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)

I've tried to play with the settings of the project, add "-libraryjars" to include other jars, and many other things, but nothing helped.

like image 947
android developer Avatar asked Jun 14 '12 08:06

android developer


1 Answers

ok , i've added the next things that i've gathered from multiple websites:

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

together with the next code for each class that is used for json(with get&set), i think the apk is being created but i'm not sure if what i've written is enough to make it work well , and also if some of what i've written is not needed :

-keep public class MyClass.** {
  public void set*(***);
  public *** get*();
}
like image 109
android developer Avatar answered Oct 13 '22 22:10

android developer