Skip to content

JacksonOnAndroid

Michal Ursiny edited this page Dec 6, 2017 · 14 revisions

This page contains information on various aspects of usage that are specific to Android platform

ProGuard

While there are no standardized settings for ProGuard usage, users have contributed sample settings that may be of use. We are happy to accept more suggestions.

Here are sample settings by @johnjohndoe:

# Jackson
-keep @com.fasterxml.jackson.annotation.JsonIgnoreProperties class * { *; }
-keep @com.fasterxml.jackson.annotation.JsonCreator class * { *; }
-keep @com.fasterxml.jackson.annotation.JsonValue class * { *; }
-keep class com.fasterxml.** { *; }
-keep class org.codehaus.** { *; }
-keepnames class com.fasterxml.jackson.** { *; }
-keepclassmembers public final enum com.fasterxml.jackson.annotation.JsonAutoDetect$Visibility { 
    public static final com.fasterxml.jackson.annotation.JsonAutoDetect$Visibility *;
}

# General
-keepattributes SourceFile,LineNumberTable,*Annotation*,EnclosingMethod,Signature,Exceptions,InnerClasses

To avoid wrong name based infered linkage between getter/setter method and field, it is recommended to disable MapperFeature.INFER_PROPERTY_MUTATORS.