# Add project specific ProGuard rules here. # By default, the flags in this file are appended to flags specified # in D:\Android\AndroidStudioSdk/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 *; #} # copyright zhonghanwen #-------------------------------------------基本不用动区域-------------------------------------------- #---------------------------------基本指令区---------------------------------- -dontwarn -ignorewarnings -optimizationpasses 5 -dontskipnonpubliclibraryclassmembers -printmapping proguardMapping.txt -optimizations !code/simplification/cast,!field/*,!class/merging/* -keepattributes *Annotation*,InnerClasses -keepattributes Signature -keepattributes SourceFile,LineNumberTable #---------------------------------------------------------------------------- #---------------------------------默认保留区--------------------------------- #继承activity,application,service,broadcastReceiver,contentprovider....不进行混淆 -keep public class * extends android.app.Activity -keep public class * extends android.app.Application -keep public class * extends android.support.multidex.MultiDexApplication -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 * extends android.view.View -keep public class com.android.vending.licensing.ILicensingService -keep class android.support.** {*;} -keep public class * extends android.view.View{ *** get*(); void set*(***); public (android.content.Context); public (android.content.Context, android.util.AttributeSet); public (android.content.Context, android.util.AttributeSet, int); } -keepclasseswithmembers class * { public (android.content.Context, android.util.AttributeSet); public (android.content.Context, android.util.AttributeSet, int); } #这个主要是在layout 中写的onclick方法android:onclick="onClick",不进行混淆 -keepclassmembers class * extends android.app.Activity { public void *(android.view.View); } -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(); } -keep class **.R$* { *; } -keepclassmembers class * { void *(*Event); } -keepclassmembers enum * { public static **[] values(); public static ** valueOf(java.lang.String); } -keep class * implements android.os.Parcelable { public static final android.os.Parcelable$Creator *; } #// natvie 方法不混淆 -keepclasseswithmembernames class * { native ; } #保持 Parcelable 不被混淆 -keep class * implements android.os.Parcelable { public static final android.os.Parcelable$Creator *; } ####################zxing##################### -keep class com.google.zxing.** {*;} -dontwarn com.google.zxing.** #下面中括号的地方需要要填你的包名 -keep public class [com.example.administrator.zhapp].R$*{ public static final int *; } -keepclassmembers class * { public (org.json.JSONObject); } -keepclassmembers enum * { public static **[] values(); public static ** valueOf(java.lang.String); } #-ButterKnife 7.0 -keep class butterknife.** { *; } -dontwarn butterknife.internal.** -keep class **$$ViewBinder { *; } -keepclasseswithmembernames class * { @butterknife.* ; } -keepclasseswithmembernames class * { @butterknife.* ; } ################gson################## -dontwarn com.google.gson.** -keep class com.google.gson.** {*;} -keep class com.google.**{*;} -keep class sun.misc.Unsafe { *; } -keep class com.google.gson.stream.** { *; } -keep class com.example.administrator.zhapp.entity.**{ *;} -keep class com.example.administrator.zhapp.DBModel.**{ *;} -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(); } -keep public class * implements java.io.Serializable {*;} # support-v4 #https://stackoverflow.com/questions/18978706/obfuscate-android-support-v7-widget-gridlayout-issue -dontwarn android.support.v4.** -keep class android.support.v4.app.** { *; } -keep interface android.support.v4.app.** { *; } -keep class android.support.v4.** { *; } # support-v7 -dontwarn android.support.v7.** -keep class android.support.v7.internal.** { *; } -keep interface android.support.v7.internal.** { *; } -keep class android.support.v7.** { *; } # support design #@link http://stackoverflow.com/a/31028536 -dontwarn android.support.design.** -keep class android.support.design.** { *; } -keep interface android.support.design.** { *; } -keep public class android.support.design.R$* { *; } #------------------------------------------------------------------------- -keep class com.google.gson.examples.android.model.** { *; } #litepal -dontwarn org.litepal.* -keep class org.litepal.** { *; } -keepclassmembers class * extends org.litepal.crud.DataSupport{*;} #NOHTTP -dontwarn com.yolanda.nohttp.** -keep class com.yolanda.nohttp.**{*;} #Ksoap -keep class org.kobjects.** { *; } -keep class org.ksoap2.** { *; } -keep class org.kxml2.** { *; } -keep class org.xmlpull.** { *; } #miPush -keep class com.example.administrator.zhapp.service.MiPushMessageReceiver{*;} -dontwarn com.xiaomi.push.**