How to setup PROGUARD for Jackson JSON Processor?

前端 未结 2 532
情歌与酒
情歌与酒 2020-12-10 01:06

I am using Jackson JSON Processor for my app.Included this using

compile \'com.fasterxml.jackson.core:jackson-databind:2.4.2\'
compile \'com.fasterxml.jackso         


        
相关标签:
2条回答
  • 2020-12-10 01:24

    Modified a litte from @goonerDroid work for me

    -keepattributes *Annotation*,EnclosingMethod,Signature
    -keepnames class com.fasterxml.jackson.** { *; }
    -dontwarn com.fasterxml.jackson.databind.**
    -keep class org.codehaus.** { *; }
    -keepclassmembers public final enum org.codehaus.jackson.annotate.JsonAutoDetect$Visibility {
        public static final org.codehaus.jackson.annotate.JsonAutoDetect$Visibility *; }
    -keep public class your.class.** {
        *;
    }
    
    0 讨论(0)
  • 2020-12-10 01:36

    After much debugging finally found the answer my Proguard configuration is

    -keepattributes *Annotation*,EnclosingMethod,Signature
    -keepnames class com.fasterxml.jackson.** { *; }
    -dontwarn com.fasterxml.jackson.databind.**
    -keep class org.codehaus.** { *; }
    -keepclassmembers public final enum org.codehaus.jackson.annotate.JsonAutoDetect$Visibility {
        public static final org.codehaus.jackson.annotate.JsonAutoDetect$Visibility *; }
    -keep public class your.class.** {
        public void set*(***);
        public *** get*();
    }
    

    your class depicts the getter setter classes/class you are using to parse your response.

    Also I added compile 'com.fasterxml.jackson.core:jackson-core:2.4.2' to my Gradle file which was missing previously. Now my Proguard works like a beast..;-)

    0 讨论(0)
提交回复
热议问题