229 lines
7.3 KiB
Prolog
229 lines
7.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
|
|
|
|
# 不忽略库中的非public的类成员
|
|
-dontskipnonpubliclibraryclassmembers
|
|
|
|
# google推荐算法
|
|
-optimizations !code/simplification/arithmetic,!code/simplification/cast,!field/*,!class/merging/*
|
|
|
|
# 避免混淆内部类、匿名类
|
|
-keepattributes InnerClasses,EnclosingMethod
|
|
|
|
# 抛出异常时保留代码行号
|
|
-keepattributes SourceFile,LineNumberTable
|
|
|
|
-verbose
|
|
|
|
-printmapping proguardMapping.txt
|
|
|
|
################support###############
|
|
-keep class android.support.** { *; }
|
|
-keep interface android.support.** { *; }
|
|
-dontwarn android.support.**
|
|
# Androidx的混淆
|
|
-keep class com.google.android.material.** {*;}
|
|
-keep class androidx.** {*;}
|
|
-keep public class * extends androidx.**
|
|
-keep interface androidx.** {*;}
|
|
-dontwarn com.google.android.material.**
|
|
-dontnote com.google.android.material.**
|
|
-dontwarn androidx.**
|
|
|
|
#kotlin
|
|
-keep class kotlin.** { *; }
|
|
-keep class kotlin.Metadata { *; }
|
|
-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);
|
|
static void checkNotNullParameter(java.lang.Object, java.lang.String);
|
|
}
|
|
|
|
################glide###############
|
|
-keep public class * implements com.bumptech.glide.module.GlideModule
|
|
-keep class * extends com.bumptech.glide.module.AppGlideModule {
|
|
<init>(...);
|
|
}
|
|
-keep public enum com.bumptech.glide.load.ImageHeaderParser$** {
|
|
**[] $VALUES;
|
|
public *;
|
|
}
|
|
-keep class com.bumptech.glide.load.data.ParcelFileDescriptorRewinder$InternalRewinder {
|
|
*** rewind();
|
|
}
|
|
#okhttp
|
|
-dontwarn com.squareup.okhttp3.**
|
|
-keep class com.squareup.okhttp3.** { *;}
|
|
-dontwarn okio.**
|
|
|
|
################retrofit###############
|
|
-dontwarn retrofit2.**
|
|
-keep class retrofit2.** { *; }
|
|
-keep class io.reactivex.rxjava2.** { *; }
|
|
-keep class org.jetbrains.kotlin.** { *; }
|
|
-keepattributes Signature
|
|
-keepattributes Exceptions
|
|
|
|
################common###############
|
|
|
|
#实体类不参与混淆
|
|
-keep class * implements android.os.Parcelable {
|
|
public static final android.os.Parcelable$Creator *;
|
|
}
|
|
-keepnames class * implements java.io.Serializable
|
|
-keepattributes Signature
|
|
-keep class **.R$* {*;}
|
|
-ignorewarnings
|
|
-dontwarn com.google.errorprone.annotations.Immutable
|
|
-keepclassmembers class **.R$* {
|
|
public static <fields>;
|
|
}
|
|
|
|
-keepclasseswithmembernames class * { # 保持native方法不被混淆
|
|
native <methods>;
|
|
}
|
|
|
|
-keepclassmembers enum * { # 使用enum类型时需要注意避免以下两个方法混淆,因为enum类的特殊性,以下两个方法会被反射调用,
|
|
public static **[] values();
|
|
public static ** valueOf(java.lang.String);
|
|
}
|
|
|
|
# 保留自定义控件(继承自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 <init>(android.content.Context, android.util.AttributeSet, int, int);
|
|
public void set*(***);
|
|
*** get* ();
|
|
}
|
|
-keep class * extends androidx.lifecycle.ViewModel
|
|
-keepclassmembers public class * extends androidx.lifecycle.ViewModel {
|
|
public <init>(...);
|
|
}
|
|
-keep class * implements androidx.viewbinding.ViewBinding {
|
|
*;
|
|
}
|
|
-keepattributes JavascriptInterface
|
|
-keepclassmembers class * {
|
|
@android.webkit.JavascriptInterface <methods>;
|
|
}
|
|
-keepclassmembers class android.webkit.WebView {
|
|
public *;
|
|
}
|
|
-keepclassmembers class * extends android.webkit.WebViewClient {
|
|
public void *(android.webkit.WebView, java.lang.String, android.graphics.Bitmap);
|
|
public boolean *(android.webkit.WebView, java.lang.String);
|
|
}
|
|
# 过滤注解
|
|
-keepattributes *Annotation*
|
|
-keep class * extends java.lang.annotation.Annotation { *; }
|
|
-keep interface * extends java.lang.annotation.Annotation { *; }
|
|
# 过滤泛型
|
|
-keepattributes Signature
|
|
#保持bean目录下文件不被混淆
|
|
-keep class com.yxjk.healthexpertclient.bean.** {*;}
|
|
-keep class com.btpj.lib_base.data.bean.** {*;}
|
|
# ImmersionBar
|
|
-keep class com.gyf.immersionbar.* {*;}
|
|
-dontwarn com.gyf.immersionbar.**
|
|
# PictureSelector
|
|
-keep class com.luck.picture.lib.** { *; }
|
|
-keep class com.luck.lib.camerax.** { *; }
|
|
-dontwarn com.yalantis.ucrop**
|
|
-keep class com.yalantis.ucrop** { *; }
|
|
-keep interface com.yalantis.ucrop** { *; }
|
|
# BaseRecyclerViewAdapterHelper混淆
|
|
-keep public class * extends com.chad.library.adapter.base.viewholder.BaseViewHolder
|
|
-keep public class * extends com.chad.library.adapter.base.viewholder.BaseDataBindingHolder
|
|
-keepclassmembers class com.chad.library.adapter.base.viewholder.BaseDataBindingHolder {
|
|
public void *(android.view.View);
|
|
}
|
|
-keepclassmembers class * extends com.chad.library.adapter.base.viewholder.BaseDataBindingHolder {
|
|
public void *(android.view.View);
|
|
}
|
|
# Gson
|
|
-keep class com.google.gson.** {*;}
|
|
-keep class com.google.**{*;}
|
|
-dontwarn com.kingja.loadsir.**
|
|
-keep class com.kingja.loadsir.** {*;}
|
|
# 对于带有回调函数的onXXEvent、**On*Listener的,不能被混淆
|
|
-keepclassmembers class * {
|
|
void *(**On*Event);
|
|
void *(**On*Listener);
|
|
}
|
|
# AgentWeb
|
|
-keep class com.just.agentweb.** {
|
|
*;
|
|
}
|
|
-dontwarn com.just.agentweb.**
|
|
#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);
|
|
}
|
|
# IM混淆配置
|
|
-keep class com.tencent.imsdk.** { *; }
|
|
# 高德地图SDK(都加上,省的以后万一加功能还得加)
|
|
-keep class com.amap.api.maps.**{*;}
|
|
-keep class com.autonavi.**{*;}
|
|
-keep class com.amap.api.trace.**{*;}
|
|
# 定位
|
|
-keep class com.amap.api.location.**{*;}
|
|
-keep class com.amap.api.fence.**{*;}
|
|
-keep class com.autonavi.aps.amapapi.model.**{*;}
|
|
# 搜索
|
|
-keep class com.amap.api.services.**{*;}
|
|
# 2D地图
|
|
-keep class com.amap.api.maps2d.**{*;}
|
|
-keep class com.amap.api.mapcore2d.**{*;}
|
|
# 导航
|
|
-keep class com.amap.api.navi.**{*;}
|
|
-keep class com.autonavi.**{*;}
|
|
# 蒲公英
|
|
#-libraryjars libs/pgyer_sdk_x.x.jar
|
|
-dontwarn com.pgyersdk.**
|
|
-keep class com.pgyersdk.** { *; }
|
|
# 极光推送
|
|
-dontoptimize
|
|
-dontpreverify
|
|
|
|
-dontwarn cn.jpush.**
|
|
-keep class cn.jpush.** { *; }
|
|
-keep class * extends cn.jpush.android.service.JPushMessageReceiver { *; }
|
|
|
|
-dontwarn cn.jiguang.**
|
|
-keep class cn.jiguang.** { *; } |