Reputation: 55
Proguard rule which I am using is below and com.example.gym.pojo is package name
-keep class com.example.gym.pojo.** { public *; }
-keepclassmembers class com.example.gym.pojo.** { public *; }
My class `import java.util.ArrayList;
public class BulkUserResponse {
public String message;
public boolean success;
public ArrayList<CustomerInfo> customers;
public ArrayList<FeesInfo> fees;}`
After Proguard rule applied class look like
import java.util.ArrayList;public class BulkUserResponse {
public ArrayList customers;
public ArrayList fees;
public String message;
public boolean success;}
I want the same pojo class as it is after applying proguard. because I want to parse all the pojo class. I am using GSON library.
After applying proguard I want my class with public ArrayList<CustomerInfo> customers
Thanks in advance.....
Upvotes: 0
Views: 606
Reputation: 55
I have added
-keepattributes Signature
And after progaurd applied my class look like, and that was I am expecting
public class BulkUserResponse {
public ArrayList<CustomerInfo> customers;
public ArrayList<FeesInfo> fees;
public String message;
public boolean success;}
Thanks Ekalips...
Upvotes: 0
Reputation: 1491
I advise you to use different approach. GSON library supports serializing and deserializing with annotations. You can do something like this:
public class BulkUserResponse {
@SerializedName("message")
@Expose
public String message;
@SerializedName("success")
@Expose
public boolean success;
@SerializedName("customers")
@Expose
public ArrayList<CustomerInfo> customers;
@SerializedName("fees")
@Expose
public ArrayList<FeesInfo> fees;
}`
This way event if field name will be obfuscated, GSON will still serialize fields with your names.
And for saving your Generic types (ArrayList<FeesInfo>
for example), use this -keepattributes Signature
. Link to original answer
Upvotes: 1