Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Proguard - IllegalArgumentException in Jackson's TypeReference class

Android application crashes if proguard is used for obfuscating. Below is the stacktrace.

Caused by: java.lang.IllegalArgumentException: Internal error: 
  TypeReference constructed without actual type information
    at a.b.a.g.b.<init>(TypeReference.java:35)
    at a.c.d.q.<init>(StdCouchDbInstance.java:22)
    at a.c.d.p.<clinit>(StdCouchDbInstance.java:22)

I am using the EktorpClient library(To work with the couchdb) and StdCouchDbInstance.java refers to this file and TypeReference.java is in this package. Any suggestion as to what option I should use in the Proguard config file to overcome this problem?

like image 359
500865 Avatar asked Feb 14 '12 19:02

500865


1 Answers

I just ran into this problem using Proguard with an Ektorp dependency. The TypeReference is a generic, and -keepattributes Signature will keep generic information.

I actually used the following, which solved my issue.

-keepattributes Signature,*Annotation*,EnclosingMethod

From the Proguard Examples:

The "Signature" attribute is required to be able to access generic types when compiling in JDK 5.0 and higher.

like image 51
David V Avatar answered Sep 22 '22 15:09

David V