148 lines
5.3 KiB
Prolog
148 lines
5.3 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
|
|
|
|
#基本指令区
|
|
-optimizationpasses 5 #指定压缩级别
|
|
-optimizations !code/simplification/arithmetic,!field/,!class/merging/ #混淆时采用的算法
|
|
-verbose #打印混淆的详细信息
|
|
-dontoptimize #关闭优化
|
|
-keepattributes Annotation #保留注解中的参数
|
|
-keepattributes Annotation,InnerClasses # 保持注解
|
|
-keepattributes Signature # 避免混淆泛型, 这在JSON实体映射时非常重要
|
|
-ignorewarnings # 屏蔽警告
|
|
-keepattributes SourceFile,LineNumberTable # 抛出异常时保留代码行号
|
|
-dontusemixedcaseclassnames
|
|
|
|
#默认保留区
|
|
-keep public class * extends android.app.Activity
|
|
-keep public class * extends androidx.fragment.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 class android.support.** {*;}
|
|
|
|
-keep class com.google.android.material.** {*;}
|
|
-keep class androidx.* {*;}
|
|
-keep public class * extends androidx.*
|
|
-keep interface androidx.**{*;}
|
|
-keep class * implements androidx.* {*;}
|
|
#androidx 混淆
|
|
-dontwarn com.google.android.material.*
|
|
-dontnote com.google.android.material.**
|
|
-dontwarn androidx.**
|
|
-printconfiguration
|
|
-keep,allowobfuscation interface androidx.annotation.Keep
|
|
-keep @androidx.annotation.Keep class *
|
|
-keepclassmembers class * {@androidx.annotation.Keep *;}
|
|
#set get方法 和 构造方法不混淆
|
|
-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);}
|
|
#onClick不进行混淆
|
|
-keepclassmembers class * extends android.app.Activity {
|
|
public void *(android.view.View);
|
|
}
|
|
# Serializable 不被混淆
|
|
-keepnames class * implements java.io.Serializable
|
|
#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();}
|
|
#保留R文件中所有静态字段
|
|
-keepclassmembers class *.R$ {
|
|
public static <fields>;
|
|
}
|
|
-keepclassmembers class * {
|
|
void ();
|
|
}
|
|
#保留枚举类中的values和valueOf方法
|
|
-keepclassmembers enum * {
|
|
public static **[] values();
|
|
public static ** valueOf(java.lang.String);
|
|
}
|
|
#保留Parcelable实现类中的Creator字段
|
|
-keep class * implements android.os.Parcelable {
|
|
public static final android.os.Parcelable$Creator *;
|
|
}
|
|
|
|
#保持 Parcelable 不被混淆
|
|
-keep class * implements android.os.Parcelable {
|
|
public static final android.os.Parcelable$Creator *;
|
|
}
|
|
#不混淆包含native方法的类的类名以及native方法名
|
|
-keepclasseswithmembernames class * {
|
|
native<methods>;
|
|
}
|
|
#避免log打印输出
|
|
-assumenosideeffects class android.util.Log {
|
|
public static *** v(...);
|
|
public static *** d(...);
|
|
public static *** i(...);
|
|
public static *** w(...);
|
|
}
|
|
#webView需要进行特殊处理
|
|
-dontwarn android.webkit.WebView
|
|
-dontwarn android.net.http.SslError
|
|
-dontwarn android.webkit.WebViewClient
|
|
-keep public class android.webkit.WebView
|
|
-keep public class android.net.http.SslError
|
|
-keep public class android.webkit.WebViewClient
|
|
#AgentWeb
|
|
-keep class com.just.agentweb.** {
|
|
*;
|
|
}
|
|
#-dontwarn com.just.agentweb.**
|
|
#九宫格组件
|
|
-dontwarn com.lwkandroid.widget.ninegridview.**
|
|
-keep class com.lwkandroid.widget.ninegridview.**{*;}
|
|
#饺子播放器
|
|
-keep public class cn.jzvd.JZMediaSystem {*; }
|
|
-keep class tv.danmaku.ijk.media.player.** {*; }
|
|
-dontwarn tv.danmaku.ijk.media.player.*
|
|
-keep interface tv.danmaku.ijk.media.player.** { *; }
|
|
#实体类不可混淆
|
|
-keep class com.xjjk.healthyclients.bean.**{ *; }
|
|
#OkHttp3 去掉缺失类警告
|
|
-dontwarn org.bouncycastle.**
|
|
-dontwarn org.conscrypt.**
|
|
-dontwarn org.openjsse.javax.net.ssl.**
|
|
-dontwarn org.openjsse.net.ssl.**
|
|
|
|
-keep class com.github.aachartmodel.aainfographics.aachartcreator.AAChartView {
|
|
public void aa_drawChartWithChartModel( com.github.aachartmodel.aainfographics.aachartcreator.AAChartModel);
|
|
}
|
|
|