Proguard obfuscating Annotations

Try this:

-keepattributes *Annotation*
-keepattributes Signature
-dontnote sun.misc.**

-keep class * implements com.google.gson.TypeAdapterFactory
-keep class * implements com.google.gson.JsonSerializer
-keep class * implements com.google.gson.JsonDeserializer

Actually, there is a proguard config in official repo on github https://github.com/google/gson/blob/master/examples/android-proguard-example/proguard.cfg


Gson uses generic type information stored in a class file when working with fields. Proguard removes such information by default, so configure it to keep all of it.

Trying adding

-keepattributes Signature
-keepattributes EnclosingMethod
-keepattributes InnerClasses
-keepattributes Annotation

For using GSON @Expose annotation

-keepattributes *Annotation*

For Gson specific classes

-keep class sun.misc.Unsafe { *; }

Prevent proguard from stripping interface information from TypeAdapterFactory,JsonSerializer, JsonDeserializer instances (so they can be used in @JsonAdapter)

-keep class * implements com.google.gson.TypeAdapterFactory
-keep class * implements com.google.gson.JsonSerializer
-keep class * implements com.google.gson.JsonDeserializer

-keep @package.annotationclassname public class *