# Add project specific ProGuard rules here. # By default, the flags in this file are appended to flags specified # in E:\AndroidSdk/tools/proguard/proguard-android.txt # You can edit the include path and order by changing the proguardFiles # directive in build.gradle. # # For more details, see # http://developer.android.com/guide/developing/tools/proguard.html # Add any project specific keep options here: # 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 *; #} #指定代码的压缩级别 -optimizationpasses 5 #包明不混合大小写 -dontusemixedcaseclassnames #不去忽略非公共的库类 -dontskipnonpubliclibraryclasses #优化 不优化输入的类文件 -dontoptimize #预校验 -dontpreverify #混淆时是否记录日志 -verbose # 混淆时所采用的算法 -optimizations !code/simplification/arithmetic,!field/*,!class/merging/* #保护注解 -keepattributes *Annotation* # 保留所有的本地native方法不被混淆 -keepclasseswithmembernames class * { native ; } # 保持哪些类不被混淆 -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.content.ContentProvider -keep public class * extends android.app.backup.BackupAgentHelper -keep public class * extends android.preference.Preference -keep public class com.android.vending.licensing.ILicensingService #如果有引用v4包可以添加下面这行 -keep public class * extends androidx.fragment.app.Fragment # 保留Activity中的方法参数是view的方法, # 从而我们在layout里面编写onClick就不会影响 -keepclassmembers class * extends android.app.Activity { public void * (android.view.View); } # 枚举类不能被混淆 -keepclassmembers enum * { public static **[] values(); public static ** valueOf(java.lang.String); } # 保留自定义控件(继承自View)不能被混淆 -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* (); } # 保留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 ; private void writeObject(java.io.ObjectOutputStream); private void readObject(java.io.ObjectInputStream); java.lang.Object writeReplace(); java.lang.Object readResolve(); } # 对R文件下的所有类及其方法,都不能被混淆 -keepclassmembers class **.R$* { *; } # 对于带有回调函数onXXEvent的,不能混淆 -keepclassmembers class * { void *(**On*Event); } #忽略警告 -ignorewarnings #----------------------记录生成的日志数据,gradle build时在本项目根目录输出--------------------------------- #未混淆的类和成员 -printseeds seeds.txt #列出从 apk 中删除的代码 -printusage unused.txt #混淆前后的映射 -printmapping mapping.txt # 避免混淆泛型 # 这在JSON实体映射时非常重要,比如fastJson -keepattributes Signature #---------------------------------------------本地Data,realm类的处理------------------------------------- -keep class com.qniao.recyclemall.bean.** { *; } # --------------------------------------------第三方Jar----------------------------------------------------- # for OkHttp SDK -dontwarn okio.** -keep class okio.**{*;} -dontwarn com.squareup.okhttp.** -dontwarn okhttp3.** -keep class okhttp3.**{*;} -dontwarn javax.annotation.** -keep class com.squareup.okhttp3.** { *;} # for alibaba oss SDK #-keep class com.alibaba.sdk.android.oss.** { *; } #-dontwarn org.apache.commons.codec.binary.** # for Glide SDK -keep class com.bumptech.glide.integration.okhttp3.OkHttpGlideModule -keep public class * implements com.bumptech.glide.module.GlideModule -keep public enum com.bumptech.glide.load.resource.bitmap.ImageHeaderParser$** { **[] $VALUES; public *; } #libraryjars libs/BaiduLBS_Android.jar #-dontwarn com.baidu.** #-dontwarn vi.com.** #-keep class com.baidu.** { *; } #-keep class vi.com.** { *; } #-dontwarn org.apache.http.entity.mime.** #-keep class org.apache.http.entity.mime.**{*;} ##---------------Begin: proguard configuration for Gson ---------- # Gson uses generic type information stored in a class file when working with fields. Proguard # Gson specific classes -keep class sun.misc.Unsafe { *; } #-keep class com.google.gson.stream.** { *; } # Application classes that will be serialized/deserialized over Gson -keepclassmembers class * { public (org.json.JSONObject); } #EventBus -keepclassmembers class ** { @org.greenrobot.eventbus.Subscribe ; } -keep enum org.greenrobot.eventbus.ThreadMode { *; } # Only required if you use AsyncExecutor -keepclassmembers class * extends org.greenrobot.eventbus.util.ThrowableFailureEvent { (Java.lang.Throwable); } #EventBus -keepattributes *Annotation* -keepclassmembers class ** { @org.greenrobot.eventbus.Subscribe ; } -keep enum org.greenrobot.eventbus.ThreadMode { *; } #okgo -dontwarn com.lzy.okgo.** -keep class com.lzy.okgo.**{*;} #immersionbar -keep class com.gyf.immersionbar.* {*;} -dontwarn com.gyf.immersionbar.** #toast -keep class com.hjq.toast.** {*;} #autosize -keep class me.jessyan.autosize.** { *; } -keep interface me.jessyan.autosize.** { *; } #bugly -dontwarn com.tencent.bugly.** -keep public class com.tencent.bugly.**{*;} -keep public class javax.** -keep public class android.webkit.** -keepattributes Exceptions,InnerClasses,Signature -keepattributes *Annotation* -keepattributes SourceFile,LineNumberTable -keepclassmembers enum * { public static **[] values(); public static ** valueOf(java.lang.String); } -dontwarn android.net.** -keep class android.net.SSLCertificateSocketFactory{*;} -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; }