xref: /aosp_15_r20/external/gson/examples/android-proguard-example/proguard.cfg (revision a8de600362638ea28fd6cb3225451dc706d269bb)
1##---------------Begin: proguard configuration for Gson  ----------
2# Gson uses generic type information stored in a class file when working with fields. Proguard
3# removes such information by default, so configure it to keep all of it.
4-keepattributes Signature
5
6# For using GSON @Expose annotation
7-keepattributes *Annotation*
8
9# Gson specific classes
10-dontwarn sun.misc.**
11#-keep class com.google.gson.stream.** { *; }
12
13# Application classes that will be serialized/deserialized over Gson
14-keep class com.google.gson.examples.android.model.** { <fields>; }
15
16# Prevent proguard from stripping interface information from TypeAdapter, TypeAdapterFactory,
17# JsonSerializer, JsonDeserializer instances (so they can be used in @JsonAdapter)
18-keep class * extends com.google.gson.TypeAdapter
19-keep class * implements com.google.gson.TypeAdapterFactory
20-keep class * implements com.google.gson.JsonSerializer
21-keep class * implements com.google.gson.JsonDeserializer
22
23# Prevent R8 from leaving Data object members always null
24-keepclassmembers,allowobfuscation class * {
25  @com.google.gson.annotations.SerializedName <fields>;
26}
27
28# Retain generic signatures of TypeToken and its subclasses with R8 version 3.0 and higher.
29-keep,allowobfuscation,allowshrinking class com.google.gson.reflect.TypeToken
30-keep,allowobfuscation,allowshrinking class * extends com.google.gson.reflect.TypeToken
31
32##---------------End: proguard configuration for Gson  ----------
33