# 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 senderName 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 senderName. #-renamesourcefileattribute SourceFile #指定压缩级别 -optimizationpasses 5 #不跳过非公共的库的类成员 -dontskipnonpubliclibraryclassmembers #混淆时采用的算法 -optimizations !code/simplification/arithmetic,!field/*,!class/merging/* #把混淆类中的方法名也混淆了 -useuniqueclassmembernames #优化时允许访问并修改有修饰符的类和类的成员 -allowaccessmodification #将文件来源重命名为“SourceFile”字符串 -renamesourcefileattribute SourceFile #保留行号 -keepattributes SourceFile,LineNumberTable #保持泛型 -keepattributes Signature #保持所有实现 Serializable 接口的类成员 -keepclassmembers class * implements java.io.Serializable { static final long serialVersionUID; private 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(); } #Fragment不需要在AndroidManifest.xml中注册,需要额外保护下 -keep public class * extends android.support.v4.app.Fragment -keep public class * extends android.app.Fragment # 保持测试相关的代码 -dontnote junit.framework.** -dontnote junit.runner.** -dontwarn android.test.** -dontwarn android.support.test.** -dontwarn org.junit.** #高徳地图 -dontwarn com.amap.api.** #-dontwarn com.a.a.** -dontwarn com.autonavi.** -keep class com.amap.api.** {*;} -keep class com.autonavi.** {*;} #-keep class com.a.a.** {*;} #-------------- okhttp3 start------------- # https://github.com/square/okhttp -keepattributes Signature -keepattributes *Annotation* -keep class com.squareup.okhttp.* { *; } -keep interface com.squareup.okhttp.** { *; } -dontwarn com.squareup.okhttp.** # okhttp 3 -keepattributes Signature -keepattributes *Annotation* -keep class okhttp3.** { *; } -keep interface okhttp3.** { *; } -dontwarn okhttp3.** # Okio -dontwarn com.squareup.** -dontwarn okio.** -keep public class org.codehaus.* { *; } -keep public class java.nio.* { *; } #----------okhttp end-------------- #QMUI -keep class **_FragmentFinder { *; } -keep class com.qmuiteam.qmui.arch.record.** { *; } -keep class androidx.fragment.app.* { *; } ##Glide -dontwarn com.bumptech.glide.** -keep class com.bumptech.glide.**{*;} -keep public class * implements com.bumptech.glide.module.GlideModule -keep public class * extends com.bumptech.glide.AppGlideModule -keep public enum com.bumptech.glide.load.resource.bitmap.ImageHeaderParser$** { **[] $VALUES; public *; } #-keep class module-info #-keepattributes Module* -dontwarn module-info -dontwarn com.alibaba.fastjson.** -dontwarn kotlinx.coroutines.** -optimizations !class/unboxing/enum -dontwarn org.eclipse.paho.** -keep class org.eclipse.paho.**{*;} -dontwarn jsqlite.** -keep class jsqlite.**{*;} -dontwarn com.google.zxing.** -keep class com.google.zxing.**{*;} # Application classes that will be serialized/deserialized over Gson # 注意这里只是谷歌的一个示例,具体需要替换成你自己的各种data、entity、bean等类 -keep class com.airkoon.cellsys_rx.core.** { ; } # Prevent R8 from leaving Data object members always null -keepclassmembers,allowobfuscation class * { @com.airkoon.cellsys_rx.core.CellsyFriends ; @com.airkoon.cellsys_rx.core.CellsysDevice ; } # 保留 CellsyFriends 类及其成员(根据实际的包路径进行替换) -keep class com.airkoon.cellsys_rx.core.CellsyFriends { *; } -keep class com.airkoon.cellsys_rx.core.CellsysDevice { *; } -keep class com.google.gson.** { *; } -keep interface com.google.gson.** { *; } -keep class com.google.gson.reflect.TypeToken -keep class * extends com.google.gson.reflect.TypeToken -keep public class * implements java.lang.reflect.Type