proguard Missing type parameter

在使用GSON后, 添加混淆打包后容易出现标题所述问题:

E/BrowserCrashHandler(8889): java.lang.RuntimeException: Missing type parameter.
E/BrowserCrashHandler(8889): at com.google.gson.reflect.TypeToken.getSuperclassTypeParameter(TypeToken.java:84)
E/BrowserCrashHandler(8889): at com.google.gson.reflect.TypeToken.<init>(TypeToken.java:62)


究其原因可以参考:http://stackoverflow.com/questions/8129040/proguard-missing-type-parameter

解决方法:在 proguard.cfg中添加如下代码:

##---------------Begin: proguard configuration for Gson ---------- # Gson uses generic type information stored in a class file when working with fields. Proguard # removes such information by default, so configure it to keep all of it. -keepattributes Signature # Gson specific classes -keep class sun.misc.Unsafe { *; } #-keep class com.google.gson.stream.** { *; } # Application classes that will be serialized/deserialized over Gson -keep class com.google.gson.examples.android.model.** { *; } ##---------------End: proguard configuration for Gson ----------

你可能感兴趣的:(proguard Missing type parameter)