To prevent model classes from obfuscation. I’ve added @SerializedName annotation. Here are my proguard rules.
-keepclassmembers class * { @com.google.gson.annotations.Expose <fields>; } -keepclasseswithmembers,allowobfuscation,includedescriptorclasses class * { @com.google.gson.annotations.Expose <fields>; } <option>-dontnote com.google.gson.annotations.SerializedName</option>
<option>-keepclasseswithmembers,allowobfuscation,includedescriptorclasses
class * {
@com.google.gson.annotations.SerializedName
<fields>;
}
</option>
<option> -dontnote com.google.gson.**</option>
<option>-keepclassmembers,allowobfuscation,includedescriptorclasses class * extends com.google.gson.TypeAdapter {
public <fields>;
}</option>
<option>-keep,allowobfuscation,includedescriptorclasses class * implements com.google.gson.TypeAdapterFactory</option>
<option>-keep,allowobfuscation,includedescriptorclasses class * implements com.google.gson.JsonDeserializer</option>
<option>-keep,allowobfuscation,includedescriptorclasses class * implements com.google.gson.JsonSerializer</option>
<option>-keepclassmembers,allowobfuscation class * {
@com.google.gson.annotations.SerializedName <fields>;
}</option>
SerializedName annotation is not working as expected. Could you pls tell what is the mistake ?
In addition, I’ve ENUM classes in my project.