0

I have enabled Proguard and added proper proguard rules for all the libraries I am using.

I use Retrofit for network calls and Jackson converter for parsing responses.

My Json responses have root values, to parse this using Jackson I use setting SerializationFeature.WRAP_ROOT_VALUE and DeserializationFeature.UNWRAP_ROOT_VALUE. Everything was working till I applied proguard.

Without giving any parsing exceptions the fields are parsed as null values.

The Proguard rules I am using for Jackson are

-keepnames class com.fasterxml.jackson.** { *; }

-dontwarn com.fasterxml.jackson.databind.*

-keepattributes *Annotation*,EnclosingMethod,Signature

-keep class org.codehaus.** { *; }

-keepclassmembers public final enum 
 org.codehaus.jackson.annotate.JsonAutoDetect$Visibility {
  public static final org.codehaus.jackson.annotate.JsonAutoDetect$Visibility *;
}

-keepclasseswithmembers class com.jombay.vger.rx.resources.** {
  public protected private <init>(...);
  public void set(*);
  public ** get*();
}

-keepclasseswithmembers public class  com.jombay.vger.retrofit.resources.** {
  public protected private <init>(...);
  public void set(*);
  public ** get*();
}

-keepclasseswithmembers public class com.jombay.vger.utils.** {
  public protected private <init>(...);
}

-keepclassmembers class * {
 @org.codehaus.jackson.annotate.* *;
}

-keep class com.fasterxml.jackson.databind.ObjectMapper {*;}

-keep class com.fasterxml.jackson.databind.ObjectWriter {*;}

I have come up with this configuration after resolving lot of other issues.

Not able to debug and understand the issue here.

T. Neidhart
  • 6,060
  • 2
  • 15
  • 38
Rohan Peshkar
  • 65
  • 1
  • 11

1 Answers1

0

In your configuration to keep your domain classes, you are missing some wildcards. Instead of this

-keepclasseswithmembers class com.jombay.vger.rx.resources.** {
  public protected private <init>(...);
  public void set(*);
  public ** get*();
}

it should rather be:

-keepclasseswithmembers class com.jombay.vger.rx.resources.** {
  <init>(...);
  public void set*(***);
  public *** get*();
}
T. Neidhart
  • 6,060
  • 2
  • 15
  • 38