我在我的应用程序中使用Gson,为此,我使用的名称与使用Json的名称相同.我的应用程序运行良好,但在编写proguard时,应用程序崩溃,我猜有些类正在缩小.我的错误是:
java.lang.ClassCastException:com.google.gson.internal.StringMap无法强制转换为com.sample.package.GsonClass
Aru*_*n C 21
您需要将这些行添加到proguard中,以便在签署应用程序时保留gson类.
##---------------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 ----------
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
8212 次 |
| 最近记录: |