# 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
-optimizationpasses 5
# 混淆时不使用大小写混合，混淆后的类名为小写
-dontusemixedcaseclassnames
# 指定不去忽略非公共库的类
-dontskipnonpubliclibraryclasses
# 指定不去忽略非公共库的成员
-dontskipnonpubliclibraryclassmembers
# 混淆时不做预校验
# Android不需要preverify，去掉这一步可加快混淆速度
-dontpreverify
# 混淆时不记录日志
-verbose
# 忽略所有警告 不忽略可能打包不成功
#-ignorewarning
# 不要压缩(这个必须，因为开启混淆的时候 默认 会把没有被调用的代码 全都排除掉)
-dontshrink
# 不优化输入的类文件
-dontoptimize
# 保留注解不混淆
-keepattributes *Annotation*,InnerClasses
# 避免混淆泛型  如果混淆报错建议关掉
-keepattributes Signature
# 避免混淆异常
-keepattributes Exceptions
# 保留代码行号，方便异常信息的追踪
-keepattributes SourceFile,LineNumberTable
-keepattributes LocalVariableTable,LocalVariableTypeTable
-keepattributes Exceptions,InnerClasses,Signature,Deprecated,SourceFile,LineNumberTable,*Annotation*,EnclosingMethod,LocalVariableTable,LocalVariableTypeTable

# 混淆采用的算法
#-optimizations !code/simplification/cast,!field/*,!class/merging/*
-optimizations code/removal/variable,code/simplification/arithmetic
#-optimizations !code/simplification/arithmetic,!code/simplification/cast,!field/*,!class/merging/*
# 确定统一的混淆类的成员名称来增加混淆
#-useuniqueclassmembernames

#优化时允许访问并修改类和类的成员的 访问修饰符，可能作用域会变大。
#-allowaccessmodification
#竭力合并接口，即使它们的实现类未实现合并后接口的所有方法。
#-mergeinterfacesaggressively

# dump.txt文件列出apk包内所有class的内部结构
-dump class_files.txt
# seeds.txt文件列出未混淆的类和成员
-printseeds seeds.txt
# usage.txt文件列出从apk中删除的代码
-printusage unused.txt
# mapping.txt文件列出混淆前后的映射
-printmapping mapping.txt

#不需混淆的Android类
-keep public class * extends android.app.Fragment
-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.preference.Preference
-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 com.android.vending.licensing.ILicensingService

#support下的所有类及其内部类
-keep class android.** {*;}
-keep class android.support.** {*;}
-dontwarn android.support.**
-keep interface 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.**

#support v4/7库
-keep public class * extends android.support.v4.**
-keep public class * extends android.support.v7.**
-keep public class * extends android.support.annotation.**

#support design库
-dontwarn android.support.design.**
-keep class android.support.design.** { *; }
-keep interface android.support.design.** { *; }
-keep public class android.support.design.R$* { *; }

#material
-keep class com.google.android.material.** {*;}
-dontwarn com.google.android.material.**
-dontnote com.google.android.material.**

#避免混淆自定义控件类的 get/set 方法和构造函数
-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);
}

#关闭 Log日志 （-dontoptimize不要配置，不然将会关闭优化，导致日志语句不会被优化掉。）
-assumenosideeffects class android.util.Log {
    public static boolean isLoggable(java.lang.String, int);
    public static int v(...);
    public static int i(...);
    public static int w(...);
    public static int d(...);
    public static int e(...);
}

#避免资源混淆
-keep class **.R$* {*;}

#避免layout中onclick方法（android:onclick="onClick"）混淆
-keepclassmembers class * extends android.app.Activity{
    public void *(android.view.View);
}

#避免回调函数 onXXEvent 混淆
-keepclassmembers class * {
    void *(*Event);
    void *(*Listener);
}

# 对于带有回调函数的onXXEvent、**On*Listener的，不能被混淆
-keepclassmembers class * {
    void *(**On*Event);
    void *(**On*Listener);
}

#避免混淆枚举类
-keepclassmembers enum * {
    public static **[] values();
    public static ** valueOf(java.lang.String);
}

#Natvie 方法不混淆
-keepclasseswithmembernames class * {
    native <methods>;
}

#避免Parcelable混淆
-keep class * implements android.os.Parcelable {
  public static final android.os.Parcelable$Creator *;
}

#避免Serializable接口的子类中指定的某些成员变量和方法混淆
-keepclassmembers class * implements java.io.Serializable {
    static final long serialVersionUID;
    private static final java.io.ObjectStreamField[] serialPersistentFields;
    !static !transient <fields>;
    private void writeObject(java.io.ObjectOutputStream);
    private void readObject(java.io.ObjectInputStream);
    java.lang.Object writeReplace();
    java.lang.Object readResolve();
}

# webView处理，项目中没有使用到webView忽略即可
-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, jav.lang.String);
}
-keepattributes JavascriptInterface

#ButterKnife混淆配置
-keep class butterknife.** { *; }
-dontwarn butterknife.internal.**
-keep class **$$ViewBinder { *; }
-keepclasseswithmembernames class * {
    @butterknife.* <fields>;
}
-keepclasseswithmembernames class * {
    @butterknife.* <methods>;
}

# okhttp
-keep class com.squareup.okhttp.* { *; }
-keep interface com.squareup.okhttp.** { *; }
-dontwarn com.squareup.okhttp.**
-dontwarn com.squareup.okhttp3.**

# okhttp3
-keep class okhttp3.** { *; }
-keep interface okhttp3.** { *; }
-dontwarn okhttp3.**

#okhttputils
-dontwarn com.zhy.http.**
-keep class com.zhy.http.**{*;}

# Okio
-dontwarn com.squareup.**
-dontwarn okio.**
-keep class okio.**{*;}
-keep public class org.codehaus.* { *; }
-keep public class java.nio.* { *; }

# Retrofit
-dontwarn retrofit.**
-keep class retrofit.** { *; }
-keep class **.retrofit.** { *; }
-keepattributes Signature
-keepattributes Exceptions

# Retrofit2
-keep class retrofit2.** { *; }
-keep class **.retrofit2.** { *; }
-dontwarn retrofit2.**
-keepattributes Signature
-keepattributes Exceptions
-dontwarn okio.**
-dontwarn javax.annotation.**

#retrolambda
-dontwarn java.lang.invoke.*
-dontwarn **$$Lambda$*

#RxJava、RxAndroid混淆配置
-dontwarn sun.misc.**
-keepclassmembers class rx.internal.util.unsafe.*ArrayQueue*Field* {
    long producerIndex;
    long consumerIndex;
}
-keepclassmembers class rx.internal.util.unsafe.BaseLinkedQueueProducerNodeRef {
    rx.internal.util.atomic.LinkedQueueNode producerNode;
}
-keepclassmembers class rx.internal.util.unsafe.BaseLinkedQueueConsumerNodeRef {
    rx.internal.util.atomic.LinkedQueueNode consumerNode;
}
-dontnote rx.internal.util.PlatformDependent

#Gson混淆配置
-dontwarn sun.misc.**
-keep class com.google.gson.** {*;}
-keep class com.google.**{*;}
-keep class sun.misc.Unsafe { *; }
-keep class com.google.gson.stream.** { *; }
-keep class com.google.gson.examples.android.model.** { *; }
-keep class * implements com.google.gson.TypeAdapterFactory
-keep class * implements com.google.gson.JsonSerializer
-keep class * implements com.google.gson.JsonDeserializer

#阿里云相关
#基线包使用，生成mapping.txt
-printmapping mapping.txt
#生成的mapping.txt在app/buidl/outputs/mapping/release路径下，移动到/app路径下
#修复后的项目使用，保证混淆结果一致
#-applymapping mapping.txt
#hotfix
-keep class com.taobao.sophix.**{*;}
-keep class com.ta.utdid2.device.**{*;}
#防止inline
-dontoptimize

#facebook
-dontwarn com.facebook.**
-keep enum com.facebook.**
-keep public interface com.facebook.**
-keep class com.facebook.**
-keep class com.facebook.** { *; }
-keep class com.facebook.stetho.** { *; }
-dontwarn com.facebook.stetho.**

#oaid_sdk
#sdk
-keep class com.bun.miitmdid.** { *; }
-keep interface com.bun.supplier.*  { *; }
#asus
-keep class com.asus.msa.SupplementaryDID.** { *; }
-keep class com.asus.msa.sdid.* { *; }
#freeme
-keep class com.android.creator.** { *; }
-keep class com.android.msasdk.* { *; }
#huawei
-keep class com.huawei.hms.ads.* { *; }
-keep interface com.huawei.hms.ads.* { *; }
#lenovo
-keep class com.zui.deviceidservice.** { *; }
-keep class com.zui.opendeviceidlibrary.* { *; }
#meizu
-keep class com.meizu.flyme.openidsdk.** { *; }
#nubia
-keep class com.bun.miitmdid.provider.nubia.NubiaIdentityImpl { *; }
#oppo
-keep class com.heytap.openid.** { *; }
#samsung
-keep class com.samsung.android.deviceidservice.** { *; }
#vivo
-keep class com.vivo.identifier.** { *; }
#xiaomi
-keep class com.bun.miitmdid.provider.xiaomi.IdentifierManager { *; }
#zte
-keep class com.bun.lib.** { *; }
#coolpad
-keep class com.coolpad.deviceidsupport.** { *; }

#Mintegral android
-keepattributes Signature
-keepattributes *Annotation*
-keep class com.mbridge.** {*; }
-keep interface com.mbridge.** {*; }
-keep class android.support.v4.** { *; }
-dontwarn com.mbridge.**
-keep class **.R$* { public static final int mbridge*; }

#Mintegral androidx
-keepattributes Signature
-keepattributes *Annotation*
-keep class com.mbridge.** {*; }
-keep interface com.mbridge.** {*; }
-keep interface androidx.** { *; }
-keep class androidx.** { *; }
-keep public class * extends androidx.** { *; }
-dontwarn com.mbridge.**
-keep class **.R$* { public static final int mbridge*; }


#annotations
#-keep @android.support.annotation.Keep class **{
#@android.support.annotation.Keep <fields>;
#@android.support.annotation.Keep <methods>;
#}

#保留注解，如果不添加该行会导致我们的@Keep注解失效（只能保持与第三方的配置统一，否则修改无法生效）
#-dontobfuscate
#似乎只适用于常规类(class)
-keepparameternames
#Java 8 或更高版本
-keepattributes MethodParameters
-keepattributes *Annotation*

-keep class android.support.annotation.Keep
-keep @android.support.annotation.Keep class * {*;}

-keep class androidx.annotation.Keep
-keep @androidx.annotation.Keep class * {*;}

-keep class com.qlslylq.ad.sdk.annotation.NonNull
-keep class com.qlslylq.ad.sdk.annotation.Nullable
-keep @com.qlslylq.ad.sdk.annotation.NonNull class *{
   @com.qlslylq.ad.sdk.annotation.NonNull <fields>;
}
-keep @com.qlslylq.ad.sdk.annotation.Nullable class *{
   @com.qlslylq.ad.sdk.annotation.Nullable <fields>;
}

-keep class com.qlslylq.ad.sdk.annotation.Keep
-keep @com.qlslylq.ad.sdk.annotation.Keep class *{
   @com.qlslylq.ad.sdk.annotation.Keep <init>(...);
   @com.qlslylq.ad.sdk.annotation.Keep <fields>;
   @com.qlslylq.ad.sdk.annotation.Keep <methods>;
}

#AdDesignSDK
-keep class com.qlslylq.ad.sdk.activity.* { *; }
-keep class com.qlslylq.ad.sdk.application.* { *; }
-keep class com.qlslylq.ad.sdk.config.AdDesignHolder { *; }
-keep class com.qlslylq.ad.sdk.core.ad.SingleFeedAd { *; }
-keep class com.qlslylq.ad.sdk.core.interfaces.* { *; }
-keep interface com.qlslylq.ad.sdk.core.interfaces.* { *; }
-keep class com.qlslylq.ad.sdk.core.listener.* { *; }
-keep class * extends com.qlslylq.ad.sdk.core.listener.AdListener { *; }
-keep class com.qlslylq.ad.sdk.core.rsp.* { *; }
-keep class com.qlslylq.ad.sdk.enums.* { *; }
-keep class com.qlslylq.ad.sdk.interfaces.* { *; }
-keep class com.qlslylq.ad.sdk.listener.* { *; }
-keep class com.qlslylq.ad.sdk.manager.* { *; }
-keep class com.qlslylq.ad.sdk.method.* { *; }
-keep class com.qlslylq.ad.sdk.properties.* { *; }
-keep class com.qlslylq.ad.sdk.util.* { *; }
-keep class com.qlslylq.ad.sdk.net.netdector.NetworkUtils { *; }

