500865
500865

Reputation: 7120

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?

Upvotes: 8

Views: 2712

Answers (2)

David V
David V

Reputation: 11699

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.

Upvotes: 13

StaxMan
StaxMan

Reputation: 116582

Sounds like ProGuard is mishandling generic type information (passing of Type parameters) somehow. I don't know if this would be a known ProGuard issue; but you might check Jackson users mailing list if others have encountered this. Also, you could try different Jackson version, although I don't think class TypeReference has changed a lot.

Upvotes: 0

Related Questions