# Add project specific ProGuard rules here. # You can control the set of applied configuration files using the # proguardFiles setting in build.gradle. # # For more details, see # http://developer.android.com/guide/developing/tools/proguard.html # If your project uses WebView with JS, uncomment the following # and specify the fully qualified class name to the JavaScript interface # class: #-keepclassmembers class fqcn.of.javascript.interface.for.webview { # public *; #} # Uncomment this to preserve the line number information for # debugging stack traces. #-keepattributes SourceFile,LineNumberTable # If you keep the line number information, uncomment this to # hide the original source file name. #-renamesourcefileattribute SourceFile # 保留 Gson 核心类 -keep class com.google.gson.** { *; } -keep class com.google.gson.stream.** { *; } # 保留所有注解 -keepattributes *Annotation* -keepattributes Signature # 保留枚举类 -keepclassmembers enum * { public static **[] values(); public static ** valueOf(java.lang.String); } # 保留所有模型类(根据你的包结构调整) -keep class com.android.grape.pad.** { *; } -keep class com.example.studyapp.update.ApiResponse{ *; } -keep class com.example.studyapp.update.ApiResponseList{ *; } # 保留所有使用 @SerializedName 注解的字段 -keepclassmembers class * { @com.google.gson.annotations.SerializedName ; } # 保留所有模型类的无参构造函数 -keepclassmembers class com.android.grape.pad.** { public (); } # 保留类型适配器 -keep class * extends com.google.gson.TypeAdapter { public com.google.gson.TypeAdapter create(com.google.gson.Gson, com.google.gson.reflect.TypeToken); } # 保留 Gson 创建的类 -keep class com.google.gson.examples.android.model.** { *; } -keepattributes Signature # 保留 TypeToken 类及其子类 -keep class com.google.gson.reflect.TypeToken { *; } -keep class * extends com.google.gson.reflect.TypeToken -keep class sun.misc.Unsafe { *; } # 保留注解信息 -keepattributes *Annotation* # 保留 Kotlin 元数据(如果使用 Kotlin) -keepclassmembers class **$TypeToken { *; }