# 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 -dontusemixedcaseclassnames -dontskipnonpubliclibraryclasses -dontpreverify -verbose -optimizations !code/simplification/arithmetic,!field/*,!class/merging/* # ------ 官方模板推荐不需要混淆的组件 ------ -keep public class * extends android.app.Application -keep public class * extends android.app.Activity -keep public class * extends android.app.Service -keep public class * extends android.content.ContentProvider -keep public class * extends android.content.BroadcastReceiver -keep public class * extends android.app.backup.BackupAgentHelper -keep public class * extends android.preference.Preference -keep public class * extends android.widget.PopupWindow -keep public class * extends androidx.fragment.app.Fragment -keep class * extends android.webkit.WebChromeClient {*;} -keep class * extends android.webkit.WebViewClient {*;} -keep public class com.android.vending.licensing.ILicensingService # 忽略自定义控件 -keep public class * extends android.view.View { public (android.content.Context); public (android.content.Context, android.util.AttributeSet); public (android.content.Context, android.util.AttributeSet, int); public void set*(...); *** get*(); } -keepclassmembers class * extends android.app.Activity{ public void *(android.view.View); } ## 禁止混淆枚举类型 -keepclassmembers,allowoptimization enum * { public static **[] values(); public static ** valueOf(java.lang.String); } # 忽略原生方法 -keepclasseswithmembernames class * { native ; } # 忽略枚举 -keepclassmembers enum * { public static **[] values(); public static ** valueOf(java.lang.String); } # 忽略序列化实体类 -keep class * implements android.os.Parcelable { public static final android.os.Parcelable$Creator *; } -keepnames class * implements java.io.Serializable -keepclassmembers class * implements java.io.Serializable { static final long serialVersionUID; private static final java.io.ObjectStreamField[] serialPersistentFields; !static !transient ; private void writeObject(java.io.ObjectOutputStream); private void readObject(java.io.ObjectInputStream); java.lang.Object writeReplace(); java.lang.Object readResolve(); } # 保留Annotation不混淆 -keepattributes *Annotation*,InnerClasses # 避免混淆泛型 -keepattributes Signature -keepattributes SourceFile,LineNumberTable # 保持R文件不被混淆 -keep public class **.R$* {*;} # ------ 应用定制混淆方案 ------ -keep class **.*$JavaScriptInterface{*;} -keepclassmembers class * { public (org.json.JSONObject); } -keep class com.buyao.common.activity.**{*;} -keep class com.buyao.common.fragment.**{*;} -keep class com.buyao.common.adapter.**{*;} -keep class com.buyao.common.dialog.**{*;} -keep class com.buyao.**.model.** {*;} -keep class com.buyao.**.vo.** {*;} -keep class com.buyao.**.event.** {*;} -keep public class * extends androidx.** -dontwarn androidx.** # Gson -keep class com.google.gson.** {*;} -dontwarn com.google.gson.** # Glide -keep public class * implements com.bumptech.glide.module.GlideModule -keep 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(); } # for DexGuard only #-keepresourcexmlelements manifest/application/meta-data@value=GlideModule # RxJava -keep class io.reactivex.**{*;} -dontwarn io.reactivex.** -keep class org.reactivestreams.**{*;} -dontwarn org.reactivestreams.** # retrofit2 -dontnote retrofit2.Platform -dontwarn retrofit2.Platform$Java8 -dontnote retrofit2.Platform$IOS$MainThreadExecutor -keepattributes Exceptions -keepclassmembers,allowshrinking,allowobfuscation interface * { @retrofit2.http.* ; } -dontwarn javax.annotation.** # okhttp3 -keep class okhttp3.**{*;} -dontwarn okhttp3.** -keep class okio.**{*;} -dontwarn okio.** #OSS -keep class com.alibaba.sdk.android.oss.** { *; } -dontwarn org.apache.commons.codec.binary.** #Aliyun短视频 -keep class com.aliyun.**{*;} -keep class com.duanqu.**{*;} -keep class com.qu.**{*;} -keep class com.alibaba.**{*;} -keep class component.alivc.**{*;} -keep class com.alivc.**{*;} # SwipeToLoadLayout -keep class com.aspsine.swipetoloadlayout.**{*;} -dontwarn com.aspsine.swipetoloadlayout.** #友盟 -keep class com.umeng.** {*;} -keep class com.uc.** {*;} -keepclassmembers class * { public (org.json.JSONObject); } -keepclassmembers enum * { public static **[] values(); public static ** valueOf(java.lang.String); } -keep class com.zui.** {*;} -keep class com.miui.** {*;} -keep class com.heytap.** {*;} -keep class a.** {*;} -keep class com.vivo.** {*;} #oaid -keep class com.bun.miitmdid.core.** {*;} #声网 -keep class io.agora.**{*;} #微信 -keep class com.tencent.mm.opensdk.** {*;} -keep class com.tencent.wxop.** {*;} -keep class com.tencent.mm.sdk.** {*;} -keep class com.tencent.mmkv.** {*;} #gsyvideoplayer -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 tv.danmaku.ijk.** { *; } -dontwarn tv.danmaku.ijk.** ## 禁止混淆二维码解析SDK #-libraryjars libs/facesdk.jar -dontwarn com.baidu.idl.** -keep class com.baidu.idl.**{*;} #融云 -keep class io.rong.** {*;} -keep class cn.rongcloud.** {*;} -keep class * implements io.rong.imlib.model.MessageContent {*;} -keep class io.rong.app.DemoNotificationReceiver {*;} -dontwarn io.rong.push.** -dontnote com.xiaomi.** -dontnote com.google.android.gms.gcm.** -dontnote io.rong.** # Location -keep class com.amap.api.**{*;} -keep class com.amap.api.services.**{*;} #huawei push -keep class com.hianalytics.android.**{*;} -keep class com.huawei.updatesdk.**{*;} -keep class com.huawei.hms.**{*;} -keep class com.huawei.gamebox.plugin.gameservice.**{*;} -keep public class com.huawei.android.hms.agent.** extends android.app.Activity { public *; protected *; } -keep interface com.huawei.android.hms.agent.common.INoProguard {*;} -keep class * extends com.huawei.android.hms.agent.common.INoProguard {*;}