280 lines
9.1 KiB
Prolog
280 lines
9.1 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
|
||
-obfuscationdictionary dict.txt
|
||
-classobfuscationdictionary dict.txt
|
||
-packageobfuscationdictionary dict.txt
|
||
# 基本设置
|
||
-keepattributes *Annotation*
|
||
-keepattributes Exceptions
|
||
-keepattributes InnerClasses
|
||
-keepattributes Signature
|
||
-keepattributes SourceFile,LineNumberTable
|
||
-keepattributes EnclosingMethod
|
||
-keepattributes RuntimeVisibleAnnotations
|
||
-keepattributes RuntimeInvisibleAnnotations
|
||
-keepattributes RuntimeVisibleParameterAnnotations
|
||
-keepattributes RuntimeInvisibleParameterAnnotations
|
||
|
||
# 保留 Android 基本组件
|
||
-keep public class * extends android.app.Activity
|
||
-keep public class * extends android.app.Application
|
||
-keep public class * extends android.app.Service
|
||
-keep public class * extends android.content.BroadcastReceiver
|
||
-keep public class * extends android.content.ContentProvider
|
||
-keep public class * extends android.app.backup.BackupAgentHelper
|
||
-keep public class * extends android.preference.Preference
|
||
-keep public class com.android.vending.licensing.ILicensingService
|
||
|
||
# 保留 AndroidX 组件
|
||
-keep public class * extends androidx.appcompat.app.AppCompatActivity
|
||
-keep public class * extends androidx.fragment.app.Fragment
|
||
-keep public class * extends androidx.core.app.ServiceCompat
|
||
-keep public class * extends androidx.localbroadcastmanager.content.LocalBroadcastManager
|
||
-keep public class * extends androidx.content.contentprovider.ContentProviderCompat
|
||
-keep public class * extends androidx.preference.Preference
|
||
|
||
# 保留 R 类及其子类的所有成员
|
||
-keep class **.R$* {
|
||
public static final int *;
|
||
}
|
||
|
||
# 保留 Parcelable 实现类
|
||
-keep class * implements android.os.Parcelable {
|
||
public static final android.os.Parcelable$Creator *;
|
||
}
|
||
|
||
# 保留 Serializable 类
|
||
-keepclassmembers class * implements java.io.Serializable {
|
||
static final long serialVersionUID;
|
||
private static final java.io.ObjectStreamField[] serialPersistentFields;
|
||
!static !transient <fields>;
|
||
!private <fields>;
|
||
!private <methods>;
|
||
private void writeObject(java.io.ObjectOutputStream);
|
||
private void readObject(java.io.ObjectInputStream);
|
||
java.lang.Object writeReplace();
|
||
java.lang.Object readResolve();
|
||
}
|
||
|
||
# 保留自定义 View 类
|
||
-keep public class * extends android.view.View {
|
||
public <init>(android.content.Context);
|
||
public <init>(android.content.Context, android.util.AttributeSet);
|
||
public <init>(android.content.Context, android.util.AttributeSet, int);
|
||
public void set*(...);
|
||
}
|
||
|
||
# 保留资源类的方法和属性
|
||
-keepclassmembers class **.R$*{
|
||
public static <fields>;
|
||
}
|
||
|
||
# 保留反射使用的类和方法
|
||
-keepclassmembers class * {
|
||
@android.webkit.JavascriptInterface <methods>;
|
||
public java.lang.reflect.Method get*(...);
|
||
public static java.lang.reflect.Method get*(...);
|
||
public java.lang.reflect.Field get*(...);
|
||
public static java.lang.reflect.Field get*(...);
|
||
}
|
||
|
||
# 保留 Native 方法
|
||
-keepclasseswithmembernames class * {
|
||
native <methods>;
|
||
}
|
||
|
||
# 第三方库保留规则
|
||
|
||
# Gson
|
||
-keep class com.google.gson.** { *; }
|
||
-keepattributes Signature
|
||
-keepattributes Expose
|
||
|
||
# OkHttp
|
||
-keep class okhttp3.** { *; }
|
||
-keep interface okhttp3.** { *; }
|
||
-dontwarn okhttp3.**
|
||
|
||
# Retrofit
|
||
-keep class retrofit2.** { *; }
|
||
-keep interface retrofit2.** { *; }
|
||
-dontwarn retrofit2.**
|
||
-keepattributes Signature
|
||
-keepattributes Exceptions
|
||
|
||
# Glide
|
||
-keep public class * implements com.bumptech.glide.module.GlideModule
|
||
-keep public class * extends com.bumptech.glide.module.AppGlideModule
|
||
-keep public enum com.bumptech.glide.load.ImageHeaderParser$** {
|
||
**[] $VALUES;
|
||
public *;
|
||
}
|
||
|
||
# AndroidX 库特定类保留
|
||
-keep class androidx.lifecycle.** { *; }
|
||
-keep class androidx.room.** { *; }
|
||
-keep class androidx.recyclerview.widget.** { *; }
|
||
-keep class androidx.viewpager2.widget.** { *; }
|
||
-keep class androidx.work.** { *; }
|
||
|
||
# Jetpack Compose
|
||
-keep class androidx.compose.runtime.** { *; }
|
||
-keep class androidx.compose.ui.** { *; }
|
||
-keep class androidx.compose.foundation.** { *; }
|
||
-keep class androidx.compose.material.** { *; }
|
||
-keep class androidx.compose.ui.text.input.** { *; }
|
||
-keep class androidx.compose.ui.platform.** { *; }
|
||
-keep class androidx.compose.ui.text.** { *; }
|
||
|
||
# Android 12+ 新特性适配
|
||
-keep class android.app.usage.** { *; }
|
||
-keep class android.content.pm.ShortcutInfo { *; }
|
||
|
||
# 忽略警告
|
||
-ignorewarnings
|
||
-keep public class * implements com.bumptech.glide.module.GlideModule
|
||
-keep public class * extends com.bumptech.glide.module.AppGlideModule
|
||
-keep public enum com.bumptech.glide.load.ImageHeaderParser$** {
|
||
**[] $VALUES;
|
||
public *;
|
||
}
|
||
-keep class com.bumptech.glide.load.data.ParcelFileDescriptorRewinder$InternalRewinder {
|
||
*** rewind();
|
||
}
|
||
|
||
# Glide 特定版本可能需要的额外规则,例如4.x版本:
|
||
-keep public class * implements com.bumptech.glide.integration.okhttp3.OkHttpUrlLoader$Factory
|
||
# 保留自定义 Bean 类及其所有成员
|
||
-keep class com.zs.smarthuman.bean.** { *; }
|
||
|
||
# 保留 Netty 核心类
|
||
-keep class io.netty.** { *; }
|
||
-keep interface io.netty.** { *; }
|
||
|
||
# 保留 Netty 注解
|
||
-keepattributes *Annotation*
|
||
|
||
# 保留 Netty 反射调用的类和方法
|
||
-keep,allowobfuscation class * extends io.netty.channel.ChannelHandler {
|
||
public <init>();
|
||
}
|
||
|
||
# 保留 Netty 服务类
|
||
-keep class io.netty.bootstrap.ServerBootstrap { *; }
|
||
-keep class io.netty.bootstrap.Bootstrap { *; }
|
||
|
||
# 保留 Netty 编解码器类
|
||
-keep class io.netty.handler.codec.** { *; }
|
||
-keep class com.zs.smarthuman.im.** { *; }
|
||
-keep class com.zs.smarthuman.proto.** { *; }
|
||
|
||
# 保留 ViewModel 及其子类不被混淆
|
||
-keep class * extends androidx.lifecycle.ViewModel {
|
||
<init>(...);
|
||
}
|
||
|
||
# 保留 ViewModelProvider.Factory 相关类
|
||
-keep class * implements androidx.lifecycle.ViewModelProvider$Factory {
|
||
<init>(...);
|
||
}
|
||
|
||
# 保留 SavedStateViewModelFactory 相关
|
||
-keep class androidx.lifecycle.SavedStateViewModelFactory
|
||
-keep class * extends androidx.lifecycle.SavedStateViewModelFactory
|
||
|
||
-keep class com.shuyu.gsyvideoplayer.video.** { *; }
|
||
-dontwarn com.shuyu.gsyvideoplayer.video.**
|
||
-keep class com.shuyu.gsyvideoplayer.video.base.** { *; }
|
||
-dontwarn com.shuyu.gsyvideoplayer.video.base.**
|
||
-keep class com.shuyu.gsyvideoplayer.utils.** { *; }
|
||
-dontwarn com.shuyu.gsyvideoplayer.utils.**
|
||
-keep class com.shuyu.gsyvideoplayer.player.** {*;}
|
||
-dontwarn com.shuyu.gsyvideoplayer.player.**
|
||
-keep class tv.danmaku.ijk.** { *; }
|
||
-dontwarn tv.danmaku.ijk.**
|
||
-keep class androidx.media3.** {*;}
|
||
-keep interface androidx.media3.**
|
||
|
||
-keep class com.shuyu.alipay.** {*;}
|
||
-keep interface com.shuyu.alipay.**
|
||
|
||
-keep public class * extends android.view.View{
|
||
*** get*();
|
||
void set*(***);
|
||
public <init>(android.content.Context);
|
||
public <init>(android.content.Context, java.lang.Boolean);
|
||
public <init>(android.content.Context, android.util.AttributeSet);
|
||
public <init>(android.content.Context, android.util.AttributeSet, int);
|
||
}
|
||
|
||
|
||
# SVG 图片显示
|
||
-keep class com.pixplicity.sharp.** { *; }
|
||
|
||
|
||
# eventbus
|
||
-keepattributes *Annotation*
|
||
-keepclassmembers class ** {
|
||
@org.greenrobot.eventbus.Subscribe <methods>;
|
||
}
|
||
-keep enum org.greenrobot.eventbus.ThreadMode { *; }
|
||
|
||
# Only required if you use AsyncExecutor
|
||
-keepclassmembers class * extends org.greenrobot.eventbus.util.ThrowableFailureEvent {
|
||
<init>(java.lang.Throwable);
|
||
}
|
||
|
||
-keepclassmembers class com.zs.smarthuman.ui.MainActivity {
|
||
void onUnityResourcesLoaded(...);
|
||
void onAudioProgressUpdated(...);
|
||
void onStreamAudioProgressUpdated(...);
|
||
void onUnityCoroutineFinished(...);
|
||
void TestBackPressed(...);
|
||
}
|
||
|
||
-keep,allowshrinking class **.reflect.TypeToken { *; }
|
||
-keep,allowshrinking class * extends **.reflect.TypeToken
|
||
|
||
|
||
# 保持jLatexMath库不被混淆(适用于ru.noties:jlatexmath-android)
|
||
-keep class ru.noties.jlatexmath.** { *; }
|
||
-keep interface ru.noties.jlatexmath.** { *; }
|
||
-keep enum ru.noties.jlatexmath.** { *; }
|
||
|
||
# 如果使用了其他LaTeX相关库(如org.scilab.forge.jlatexmath),添加对应规则
|
||
-keep class org.scilab.forge.jlatexmath.** { *; }
|
||
-keep interface org.scilab.forge.jlatexmath.** { *; }
|
||
-keep enum org.scilab.forge.jlatexmath.** { *; }
|
||
|
||
# 保留项目中使用LaTeX的自定义类(替换为实际包路径)
|
||
-keep class com.zs.smarthuman.latex.** { *; } # 假设你的LaTeX相关类在这个包下
|
||
|
||
# 保留LaTeX渲染相关的注解和类成员
|
||
-keepattributes *Annotation*
|
||
-keepclassmembers class ru.noties.jlatexmath.** {
|
||
<fields>;
|
||
<methods>;
|
||
}
|
||
-keepclassmembers class org.scilab.forge.jlatexmath.** {
|
||
<fields>;
|
||
<methods>;
|
||
} |