Proguard implementation in Android throws Gson error

I am trying to implement Proguard for my Android project. I am using Android Studio for this. But to find many difficulties in implementation. Is there a good tutorial to solve all problems. The code below that I used got an exception like the one that cannot be used. Can anyone help me get rid of this problem.

In my proguard-rules.txt I also used the below lines. But this solves my problem.

-keep class com.google.gson.**{*;}
-dontwarn com.google.gson.**


public class Home_CityDet implements Serializable{

private static final long serialVersionUID = 1L;
@SerializedName("key")
public String key;
@SerializedName("value")
public String value ;   
}

java.lang.ClassCastException: com.google.gson.internal.LinkedTreeMap cannot be cast to webservices.responses.Home_CityDet

      

+3


source to share


1 answer


I had to add progaurd config:

-keepattributes Signature
-keepattributes *Annotation*
-keep class Home_CityDet  {
*;
}

      



and the error magically disappeared

+1


source







All Articles