209 lines
7.6 KiB
Prolog
209 lines
7.6 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
|
||
|
||
|
||
# 指定代码的压缩级别 0 - 7(指定代码进行迭代优化的次数,在Android里面默认是5,这条指令也只有在可以优化时起作用。)
|
||
-optimizationpasses 5
|
||
# 混淆时不会产生形形色色的类名(混淆时不使用大小写混合类名)
|
||
-dontusemixedcaseclassnames
|
||
# 指定不去忽略非公共的库类(不跳过library中的非public的类)
|
||
-dontskipnonpubliclibraryclasses
|
||
# 指定不去忽略包可见的库类的成员
|
||
-dontskipnonpubliclibraryclassmembers
|
||
#不对 class 进行优化,默认是开启优化的。由于优化会进行类合并、内联等,使用热修复的应用,建议关闭优化
|
||
#-dontoptimize
|
||
# 不进行预校验,Android不需要,可加快混淆速度。
|
||
-dontpreverify
|
||
|
||
# 屏蔽警告,暂不开启。用于抛出异常
|
||
#-ignorewarnings
|
||
# 指定混淆是采用的算法,后面的参数是一个过滤器
|
||
# 这个过滤器是谷歌推荐的算法,一般不做更改
|
||
-optimizations !code/simplification/arithmetic,!field/*,!class/merging/*
|
||
# 保护代码中的Annotation不被混淆
|
||
-keepattributes *Annotation*,InnerClasses,Signature,EnclosingMethod
|
||
# 避免混淆泛型, 这在JSON实体映射时非常重要
|
||
-keepattributes Signature
|
||
# 抛出异常时保留代码行号
|
||
-keepattributes SourceFile,LineNumberTable
|
||
#优化时允许访问并修改有修饰符的类和类的成员,这可以提高优化步骤的结果。
|
||
# 比如,当内联一个公共的getter方法时,这也可能需要外地公共访问。
|
||
# 虽然java二进制规范不需要这个,要不然有的虚拟机处理这些代码会有问题。当有优化和使用-repackageclasses时才适用。
|
||
#指示语:不能用这个指令处理库中的代码,因为有的类和类成员没有设计成public ,而在api中可能变成public
|
||
-allowaccessmodification
|
||
# 混淆时记录日志(打印混淆的详细信息)
|
||
# 这句话能够使我们的项目混淆后产生映射文件
|
||
# 包含有类名->混淆后类名的映射关系
|
||
-verbose
|
||
# 保持测试相关的代码
|
||
-dontnote junit.framework.**
|
||
-dontnote junit.runner.**
|
||
-dontwarn android.test.**
|
||
-dontwarn android.support.test.**
|
||
-dontwarn org.junit.**
|
||
|
||
#
|
||
# ----------------------------- 默认保留 -----------------------------
|
||
#
|
||
#----------------------------------------------------
|
||
# 保持哪些类不被混淆
|
||
#继承activity,application,service,broadcastReceiver,contentprovider....不进行混淆
|
||
|
||
-keep public class * extends android.app.Activity
|
||
-keep public class * extends android.app.Fragment
|
||
-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 * extends android.view.View
|
||
|
||
-keep public class androidx.**{*;}
|
||
-keep public class * extends androidx.**{*;}
|
||
-keep interface androidx.**{*;}
|
||
-keep class androidx.appcompat.app.*{*;}
|
||
-keep class androidx.appcompat.app.AppCompatActivity{*;}
|
||
-keep class androidx.appcompat.app.AppCompatCallback{*;}
|
||
-keep class androidx.appcompat.app.AppCompatDelegate{*;}
|
||
|
||
-dontwarn androidx.**
|
||
|
||
-keep public class android.support.design.R$* { *; }
|
||
-keep class com.google.android.material.**{*;}
|
||
-dontwarn android.support.design.**
|
||
-dontwarn com.google.android.material.**
|
||
|
||
-keepclasseswithmembernames,allowshrinking class * {
|
||
native <methods>;
|
||
}
|
||
|
||
#这个主要是在layout 中写的onclick方法android:onclick="onClick",不进行混淆
|
||
#表示不混淆Activity中参数是View的方法
|
||
-keepclassmembers class * extends android.app.Activity{
|
||
public void *(android.view.View);
|
||
}
|
||
#表示不混淆枚举中的values()和valueOf()方法
|
||
-keepclassmembers enum * {
|
||
public static **[] values();
|
||
public static ** valueOf(java.lang.String);
|
||
}
|
||
|
||
#表示不混淆任何一个View中的setXxx()和getXxx()方法,
|
||
#因为属性动画需要有相应的setter和getter的方法实现,混淆了就无法工作了。
|
||
-keep public class * extends android.view.View{
|
||
*** get*();
|
||
void set*(***);
|
||
public <init>(android.content.Context);
|
||
public <init>(android.content.Context, android.util.AttributeSet);
|
||
public <init>(android.content.Context, android.util.AttributeSet, int);
|
||
}
|
||
-keepclasseswithmembers class * {
|
||
public <init>(android.content.Context, android.util.AttributeSet);
|
||
public <init>(android.content.Context, android.util.AttributeSet, int);
|
||
}
|
||
|
||
#表示不混淆Parcelable
|
||
-keep class * implements android.os.Parcelable {
|
||
public static final android.os.Parcelable *;
|
||
}
|
||
|
||
# 这指定了继承Serizalizable的类的如下成员不被移除混淆
|
||
-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();
|
||
}
|
||
|
||
# 保留R下面的资源
|
||
-keep class **.R$* {
|
||
*;
|
||
}
|
||
|
||
#不混淆资源类下static的
|
||
-keepclassmembers class **.R$* {
|
||
public static <fields>;
|
||
}
|
||
|
||
# 对于带有回调函数的onXXEvent、**On*Listener的,不能被混淆
|
||
-keepclassmembers class * {
|
||
void *(**On*Event);
|
||
void *(**On*Listener);
|
||
}
|
||
|
||
#(可选)避免Log打印输出
|
||
-assumenosideeffects class android.util.Log {
|
||
public static *** v(...);
|
||
public static *** d(...);
|
||
public static *** i(...);
|
||
public static *** w(...);
|
||
}
|
||
|
||
#kotlin
|
||
-keep class kotlin.* { *; }
|
||
-keepclassmembernames class kotlinx.*{
|
||
volatile <fields>;
|
||
}
|
||
-keep class kotlin.Metadata { *; }
|
||
-dontwarn kotlin.*
|
||
-dontwarn kotlin.**
|
||
-keepclassmembers class **$WhenMappings {
|
||
<fields>;
|
||
}
|
||
-keepclassmembers class kotlin.Metadata {
|
||
public <methods>;
|
||
}
|
||
-assumenosideeffects class kotlin.jvm.internal.Intrinsics {
|
||
static void checkParameterIsNotNull(java.lang.Object, java.lang.String);
|
||
}
|
||
-keepclassmembers class kotlin.Metadata { *; }
|
||
-keep @kotlin.Metadata class *
|
||
-keepclasseswithmembers @kotlin.Metadata class * { *; }
|
||
|
||
-keep class kotlinx.coroutines.android.** {*;}
|
||
# ServiceLoader support
|
||
-keepnames class kotlinx.coroutines.internal.MainDispatcherFactory {}
|
||
-keepnames class kotlinx.coroutines.CoroutineExceptionHandler {}
|
||
-keepnames class kotlinx.coroutines.android.AndroidExceptionPreHandler {}
|
||
-keepnames class kotlinx.coroutines.android.AndroidDispatcherFactory {}
|
||
|
||
-keep class android.telephony.TelephonyManager{*;}
|
||
-keep class android.telephony.TelephonyManager$CellInfoCallback{*;}
|
||
-dontwarn android.telephony.TelephonyManager
|
||
|
||
-dontwarn org.apache.*.**
|
||
-dontwarn org.dom4j.*.**
|
||
-dontwarn com.pdager.*.**
|
||
-dontwarn com.*.**
|
||
-dontwarn javax.*.**
|
||
-dontwarn android.support.**
|
||
|
||
|
||
-keep class com.zhidao.libyuv.*{*;}
|
||
-keep class com.mogo.cloud.network.*{*;}
|
||
-keep class com.mogo.cloud.util.*{*;}
|
||
-keep class com.mogo.cloud.wifi.*{*;}
|
||
-keep class com.mogo.cloud.wifi.*{*;}
|