123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263 |
- # 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
- # =================================================================
- # =========================== 通用設置 ===========================
- # =================================================================
- #-renamesourcefileattribute SourceFile
- -optimizationpasses 7
- # 混淆时不使用大小写混合,混淆后的类名为小写
- # windows下的同学还是加入这个选项吧(windows大小写不敏感)
- -dontusemixedcaseclassnames
- # 指定不去忽略非公共的库的类
- # 默认跳过,有些情况下编写的代码与类库中的类在同一个包下,并且持有包中内容的引用,此时就需要加入此条声明
- -dontskipnonpubliclibraryclasses
- -keepattributes EnclosingMethod
- # 指定不去忽略非公共的库的类的成員
- -dontskipnonpubliclibraryclassmembers
- # 不做预检验,preverify是proguard的四个步骤之一
- # Android不需要preverify,去掉这一步可以加快混淆速度
- -dontpreverify
- # 指定混淆时采用的算法,后面的参数是一个过滤器
- # 这个过滤器是谷歌推荐的算法,一般不改变
- -optimizations !code/simplification/artithmetic,!field/*,!class/merging/*
- # 保护代码中的Annotation不被混淆
- # 这在JSON实体映射时非常重要,比如fastJson
- -keepattributes *Annotation*
- ###排除所有注解类
- -keep class * extends java.lang.annotation.Annotation { *; }
- -keep interface * extends java.lang.annotation.Annotation { *; }
- -dontwarn javax.annotation.**
- # 避免混淆exp类,内部类,以及泛型
- # 这在JSON实体映射时非常重要,比如fastJson
- -keepattributes Exceptions,InnerClasses,Signature
- # 抛出异常时保留代码行号
- -keepattributes SourceFile,LineNumberTable
- #下面这行代码是 忽略警告,避免打包时某些警告出现
- -ignorewarnings
- # 保留所有的本地native方法不被混淆
- -keepclassmembers class * {
- native <methods>;
- }
- -keepclasseswithmembernames class * {
- native <methods>;
- }
- # 保留了继承自Activity、Application这些类的子类
- # 因为这些子类有可能被外部调用
- # 比如第一行就保证了所有Activity的子类不要被混淆
- -keep public class javax.**
- -keep public class android.webkit.**
- -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 * extends android.arch.lifecycle.AndroidViewModel
- -keep public class * extends android.view.View
- -keep public class com.android.vending.licensing.ILicensingService
- # 保留support下的所有类及其内部类
- -keep class android.support.** {*;}
- #support.v4/v7包不混淆
- #-keep public class * extends android.support.v4.**
- #-keep interface android.support.v4.app.** { *; }
- #-keep class android.support.v7.** { *; }
- #-keep public class * extends android.support.v7.**
- #-keep interface android.support.v7.app.** { *; }
- #-keep class androidx.recyclerview.widget.RecyclerView {*;}
- #-dontwarn android.support.** # 忽略警告
- -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.**
- # 保留R下面的资源
- -keep class **.R$* {*;}
- #webview
- -dontwarn android.webkit.WebView
- #-----------处理js交互---------------
- -keepclassmembers class fqcn.of.javascript.interface.for.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);
- }
- -keepclassmembers class * extends android.webkit.WebViewClient {
- public void *(android.webkit.WebView, java.lang.String);
- }
- -keepclassmembers class * {
- @android.webkit.JavascriptInterface <methods>;
- }
- -keepclassmembers public class com.swago.room.game.GamePlayDialog$JSLoad{
- <fields>;
- <methods>;
- public *;
- private *;
- }
- # 如果有引用android-support-v4.jar包,可以添加下面这行 ???
- -keep public class com.null.test.ui.fragment.** {*;}
- # 保留Activity中的方法参数是view的方法,
- # 从而我们在layout里面编写onClick就不会影响
- -keepclassmembers class * extends android.app.Activity {
- public void * (android.view.View);
- }
- # 枚举类不能被混淆
- -keep enum *
- -keepclassmembers enum * {
- public static **[] values();
- public static ** valueOf(java.lang.String);
- }
- -keepclassmembers class * implements java.io.Serializable {
- static final long serialVersionUID;
- 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();
- }
- -keepnames class * implements android.os.Parcelable {
- public static final ** CREATOR;
- }
- ##---------------Begin: proguard configuration for Gson ----------
- # Gson uses generic type information stored in a class file when working with fields. Proguard
- # removes such information by default, so configure it to keep all of it.
- -keepattributes Signature
- # For using GSON @Expose annotation
- -keepattributes *Annotation*
- # Gson specific classes
- -dontwarn sun.misc.**
- #-keep class com.google.gson.stream.** { *; }
- # Application classes that will be serialized/deserialized over Gson
- -keep class com.google.gson.examples.android.model.** { <fields>; }
- # Prevent proguard from stripping interface information from TypeAdapter, TypeAdapterFactory,
- # JsonSerializer, JsonDeserializer instances (so they can be used in @JsonAdapter)
- -keep class * extends com.google.gson.TypeAdapter
- -keep class * implements com.google.gson.TypeAdapterFactory
- -keep class * implements com.google.gson.JsonSerializer
- -keep class * implements com.google.gson.JsonDeserializer
- # Prevent R8 from leaving Data object members always null
- -keepclassmembers,allowobfuscation class * {
- @com.google.gson.annotations.SerializedName <fields>;
- }
- # =========================== 混淆输出配置 ===========================
- # 有了verbose这句话,混淆后就会生成映射文件
- # 包含有类名->混淆后类名的映射关系
- # 然后使用printmapping指定映射文件的名称
- -verbose
- #记录生成的日志数据,gradle build时在本项目根目录输出
- #apk 包内所有 class 的内部结构
- -dump class_files.txt
- #未混淆的类和成員
- #-printseeds seeds.txt
- #列出从 apk 中删除的代码
- #-printusage unused.txt
- #混淆前后的映射
- -printmapping mapping.txt
- -keep class com.swago.baseswago.model.**{*;}
- -keep class com.swago.baseswago.util.**{*;}
- -keep class com.swago.room.bean.**{*;}
- -keep class com.swago.lib_country_picker.**{*;}
- -keep class com.tencent.imsdk.** { *; }
- -keepclassmembers class * implements androidx.viewbinding.ViewBinding {
- public static * inflate(android.view.LayoutInflater);
- }
- -keep class com.huantansheng.easyphotos.models.** { *; }
- -keep class com.bumptech.glide.request.RequestOptions {*;}
- -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();
- }
- -keep class com.gyf.immersionbar.* {*;}
- -dontwarn com.gyf.immersionbar.**
- -keep class io.agora.**{*;}
- -keep class com.android.vending.billing.**
- -keep public class com.alibaba.android.arouter.routes.**{*;}
- -keep public class com.alibaba.android.arouter.facade.**{*;}
- -keep class * implements com.alibaba.android.arouter.facade.template.ISyringe{*;}
- -keep interface * implements com.alibaba.android.arouter.facade.template.IProvider
- -keep class * implements com.alibaba.android.arouter.facade.template.IProvider
- #svgplayer
- -keep class com.squareup.wire.** { *; }
- -keep class com.opensource.svgaplayer.proto.** { *; }
- #facebook
- -keep class com.facebook.applinks.** { *; }
- -keepclassmembers class com.facebook.applinks.** { *; }
- -keep class com.facebook.FacebookSdk { *; }
- -keep class com.huawei.hms.ads.** { *; }
- -keep class com.facebook.login.** { *; }
- -keepclassmembers class * extends org.greenrobot.greendao.AbstractDao {
- public static java.lang.String TABLENAME;
- }
- -keep class **$Properties { *; }
- # If you DO use SQLCipher:
- -keep class org.greenrobot.greendao.database.SqlCipherEncryptedHelper { *; }
- # If you do NOT use SQLCipher:
- -dontwarn net.sqlcipher.database.**
- # If you do NOT use RxJava:
- -dontwarn rx.**
|