android 混淆打包后 Gson拿到的实体类转换异常
16lz
2022-04-24
配置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# For using GSON @Expose annotation-keepattributes *Annotation*# 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.xxx.entity.** { *; }##---------------End: proguard configuration for Gson ----------
注意:上面倒数第二行是防止你的实体类被混淆, com.xxx.entity. 是你实体类的包路径
更多相关文章
- 解决jdk1.6已经安装,编译android源码报错问题
- Android中音频文件的使用
- Android(安卓)命令行签名打包,加固二次打包
- Android版本检测\自动更新
- Android(安卓)Studio 项目运行错误,弹出“Detected ADB对话框”
- android -------- 混淆打包报错(warning - InnerClass annotatio
- Ubuntu 下开发 Android(安卓)环境变量设置
- 设置默认来电铃声 android
- Ubuntu 下开发 Android(安卓)环境变量设置