0

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.....

Olivier Grégoire
  • 33,839
  • 23
  • 96
  • 137
Lalit Kale
  • 55
  • 1
  • 5

2 Answers2

1

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

Ekalips
  • 1,473
  • 11
  • 20
  • I am able to parse the data, but when I am trying to read members of customer class am not able to do, bcz after progaurd it difficult to to understand the which type of arraylist. My problem will get resolved if I get public ArrayList customers after progaurd applied – Lalit Kale Jun 19 '17 at 11:22
  • I have added only '-keepattributes Signature' and it worked for me – Lalit Kale Jun 19 '17 at 11:31
0

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...

Lalit Kale
  • 55
  • 1
  • 5