Gson ProGuard rules

Gson - Java library that can be used to convert Java Objects into their JSON representation.

It can also be used to convert a JSON string to an equivalent Java object. Gson can work with arbitrary Java objects including pre-existing objects that you do not have source-code of.

ProGuard rules for Gson

A shrinking phase is also applied after each optimization step, since some optimizations open the possibility to remove more classes, methods and members.. Obfuscating code that performs reflection may cause of error. To fix errors and force ProGuard to keep certain code, set up a ProGuard configuration in proguard-rules.pro file.

-keepattributes Signature
# For using GSON @Expose annotation
-keepattributes *Annotation*
# Gson specific classes
-keep class sun.misc.Unsafe { *; }
#-keep class com.google.gson.stream.** { *; }

For more information about Gson please see the website.

Related ProGuard rules

Static Gson ProGuard rules

Popular ProGuard rules