7

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?

JJD
  • 50,076
  • 60
  • 203
  • 339
500865
  • 6,920
  • 7
  • 44
  • 87

2 Answers2

14

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.

David V
  • 11,531
  • 5
  • 42
  • 66
0

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.

StaxMan
  • 113,358
  • 34
  • 211
  • 239