# 保留四大组件 -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.preference.Preference -keep public class * extends android.view.View -keep public class * extends android.database.sqlite.SQLiteOpenHelper{*;}
# 保留Appcompat下的所有类及其内部类 -keep class androidx.appcompat.* {*;}
# 保留R下的资源 -keep class **.R$* {*;}
# 保留本地Native方法 -keepclasseswithmembernames class * { native <methods>; }
# 保留在Activity中的方法参数是View的方法 -keepclassmembers class * extends android.app.Activity{ public void *(android.view.View); }
# 保留枚举类 -keepclassmembers enum * { public static **[] values(); public static ** valueOf(java.lang.String); } -keepclassmembers class * implements android.os.Parcelable { public static final ** CREATOR; } -keepclassmembers class **.R$* { public static <fields>; }
# 保留继承自View的自定义控件 -keep public class * extends android.view.View{ 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 <fields>; !private <fields>; !private <methods>; private void writeObject(java.io.ObjectOutputStream); private void readObject(java.io.ObjectInputStream); java.lang.Object writeReplace(); java.lang.Object readResolve(); }