195 lines
5.2 KiB
Prolog
195 lines
5.2 KiB
Prolog
# 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 和 TypeToken 不被混淆
|
||
-keep class com.google.gson.** { *; }
|
||
-keep class com.google.gson.reflect.TypeToken { *; }
|
||
|
||
# 保留与泛型相关的 TypeToken 使用,避免泛型信息丢失
|
||
-keep class * extends com.google.gson.reflect.TypeToken { *; }
|
||
|
||
|
||
|
||
# 保持 Gson 序列化相关的字段不被混淆
|
||
-keepclassmembers class * {
|
||
@com.google.gson.annotations.SerializedName <fields>;
|
||
}
|
||
|
||
# 保持 Gson 构造方法不被混淆
|
||
-keepclassmembers class com.google.gson.Gson {
|
||
public <init>(...);
|
||
}
|
||
|
||
|
||
#-------------------------Gson
|
||
# Gson 反射需要保留字段名
|
||
-keep class com.google.gson.stream.** { *; }
|
||
-keepattributes Signature
|
||
-keepattributes *Annotation*
|
||
|
||
# 保留实体类字段(根据需要,你可以只针对自己的 model 包)
|
||
-keepclassmembers class com.video.mobile.wallpaper.database.VideoWallpaper {
|
||
<fields>;
|
||
}
|
||
#-------------------------Gson
|
||
|
||
|
||
|
||
|
||
#-------------------------Serializable
|
||
-keepclassmembers class * implements java.io.Serializable {
|
||
static final long serialVersionUID;
|
||
private static final java.io.ObjectStreamField[] serialPersistentFields;
|
||
private void writeObject(java.io.ObjectOutputStream);
|
||
private void readObject(java.io.ObjectInputStream);
|
||
java.lang.Object writeReplace();
|
||
java.lang.Object readResolve();
|
||
}
|
||
|
||
-keep class com.video.mobile.wallpaper.database.VideoWallpaper implements java.io.Serializable { *; }
|
||
-keep class com.video.mobile.wallpaper.database.LikeWallpaper implements java.io.Serializable { *; }
|
||
|
||
#-------------------------Serializable
|
||
|
||
|
||
#-------------------------Glide
|
||
# Glide v4 混淆规则
|
||
-keep public class * implements com.bumptech.glide.module.GlideModule
|
||
-keep public class * extends com.bumptech.glide.AppGlideModule
|
||
-keep class com.bumptech.glide.GeneratedAppGlideModuleImpl { *; }
|
||
-keep public enum com.bumptech.glide.load.ImageHeaderParser$** { **[] $VALUES; public *; }
|
||
|
||
#-------------------------Glide
|
||
|
||
|
||
|
||
|
||
# Retrofit
|
||
-dontwarn retrofit2.**
|
||
-keep class retrofit2.** { *; }
|
||
-keepattributes Signature
|
||
-keepattributes Exceptions
|
||
|
||
# OkHttp
|
||
-dontwarn okhttp3.**
|
||
-keep class okhttp3.** { *; }
|
||
|
||
# RxJava(如果用 RxJava2)
|
||
-dontwarn io.reactivex.**
|
||
|
||
|
||
-keep class androidx.media3.** { *; }
|
||
-dontwarn androidx.media3.**
|
||
|
||
|
||
|
||
|
||
# 保留 Retrofit 接口
|
||
-keep interface com.video.mobile.wallpaper.network.VideoApi { *; }
|
||
-keep class com.video.mobile.wallpaper.database.LikeWallpaper { *; }
|
||
-keep class com.video.mobile.wallpaper.database.VideoWallpaper { *; }
|
||
|
||
|
||
# 保留 Retrofit 的所有类
|
||
-keep class retrofit2.** { *; }
|
||
|
||
# 保留 RxJava2 的所有类
|
||
-keep class io.reactivex.** { *; }
|
||
|
||
# 保留 CallAdapter 和 Converter 相关类
|
||
-keep class retrofit2.adapter.** { *; }
|
||
-keep class retrofit2.converter.** { *; }
|
||
|
||
# 保留类型 Token、类型适配器等相关类
|
||
-keepclassmembers class * {
|
||
@retrofit2.http.* <methods>;
|
||
}
|
||
|
||
# 保留 Retrofit 和 OkHttp 的类和构造方法
|
||
-keep class retrofit2.** { *; }
|
||
-keep class okhttp3.** { *; }
|
||
|
||
# 保留 Retrofit 接口和方法
|
||
-keep class retrofit2.Retrofit { *; }
|
||
-keep class retrofit2.Call { *; }
|
||
-keep class retrofit2.http.** { *; }
|
||
|
||
# 保留所有使用 Retrofit 注解的字段、方法和类
|
||
-keepclassmembers class * {
|
||
@retrofit2.http.* <methods>;
|
||
}
|
||
|
||
# 保留 Converter 和 CallAdapter 相关类
|
||
-keep class retrofit2.converter.** { *; }
|
||
-keep class retrofit2.adapter.** { *; }
|
||
|
||
# 保留 `@GET`, `@POST` 等注解
|
||
-keepclassmembers class * {
|
||
@retrofit2.http.GET <methods>;
|
||
@retrofit2.http.POST <methods>;
|
||
@retrofit2.http.PUT <methods>;
|
||
@retrofit2.http.DELETE <methods>;
|
||
@retrofit2.http.PATCH <methods>;
|
||
@retrofit2.http.Headers <methods>;
|
||
@retrofit2.http.Query <methods>;
|
||
@retrofit2.http.Body <methods>;
|
||
@retrofit2.http.Path <methods>;
|
||
}
|
||
|
||
# 保留 OkHttp 相关类
|
||
-keep class okhttp3.Request { *; }
|
||
-keep class okhttp3.Response { *; }
|
||
-keep class okhttp3.OkHttpClient { *; }
|
||
|
||
# 保留 OkHttp 相关的拦截器
|
||
-keep class okhttp3.Interceptor { *; }
|
||
-keep class okhttp3.logging.HttpLoggingInterceptor { *; }
|
||
|
||
# 保留 OkHttp 的构造方法
|
||
-keepclassmembers class okhttp3.** {
|
||
public <init>(...);
|
||
}
|
||
|
||
# 保留 OkHttpClient 的链式构建方式
|
||
-keepclassmembers class okhttp3.OkHttpClient {
|
||
public okhttp3.OkHttpClient$Builder newBuilder(...);
|
||
}
|
||
|
||
# 保留 HttpLoggingInterceptor 相关类
|
||
-keep class okhttp3.logging.HttpLoggingInterceptor { *; }
|
||
|
||
# 保留 Call 和 Request 方法
|
||
-keepclassmembers class okhttp3.Call {
|
||
public *;
|
||
}
|
||
-keepclassmembers class okhttp3.Request {
|
||
public *;
|
||
}
|
||
-keepclassmembers class okhttp3.Response {
|
||
public *;
|
||
}
|
||
|
||
|
||
|
||
|