#==================================【项目配置】==================================# 保留所有的本地native方法不被混淆 -keepclasseswithmembernames class * { native ; }# 保留了继承自Activity、Application这些类的子类 -keep public class * extendsandroid.app.Activity -keep public class * extendsandroid.app.Application -keep public class * extendsandroid.app.Service -keep public class * extendsandroid.content.BroadcastReceiver -keep public class * extendsandroid.content.ContentProvider -keep public class * extendsandroid.preference.Preference -keep public class * extendsandroid.view.View -keep public class * extendsandroid.database.sqlite.SQLiteOpenHelper{*;}
# 如果有引用android-support-v4.jar包,可以添加下面这行 -keep public classcom.null.test.ui.fragment.** {*;}
#如果引用了v4或者v7包 -dontwarn android.support.**
# 保留Activity中的方法参数是view的方法, # 从而我们在layout里面编写onClick就不会影响 -keepclassmembers class * extendsandroid.app.Activity { public void * (android.view.View); }# 枚举类不能被混淆 -keepclassmembers enum * { public static **[] values();public static ** valueOf(java.lang.String); }# 保留自定义控件(继承自View)不能被混淆 -keep public class * extendsandroid.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 * implementsandroid.os.Parcelable{ public static final android.os.Parcelable$Creator *; }# 保留Serializable 序列化的类不被混淆 -keepclassmembers class * implementsjava.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); }#==================================【三方配置】==================================#高德地图 -keep classcom.amap.api.location.**{*;} -keep classcom.amap.api.fence.**{*;} -keep classcom.autonavi.aps.amapapi.model.**{*;}