# 基于 sdk/tools/proguard/proguard-android-optimize.txt 修改 -optimizations !code/simplification/arithmetic,!code/simplification/cast,!field/*,!class/merging/* -optimizationpasses 5 -allowaccessmodification -dontpreverify # The remainder of this file is identical to the non-optimized version # of the Proguard configuration file (except that the other file has # flags to turn off optimization). -dontusemixedcaseclassnames -dontskipnonpubliclibraryclasses -verbose # 不混淆本地方法 see http://proguard.sourceforge.net/manual/examples.html#native -keepclasseswithmembernames class * { native ; } # 不混淆 Activity 在 XML 布局所设置的 onClick 属性值 -keepclassmembers class * extends android.app.Activity { public void *(android.view.View); } # 不混淆枚举类 see http://proguard.sourceforge.net/manual/examples.html#enumerations -keepclassmembers enum * { public static **[] values(); public static ** valueOf(java.lang.String); } # 不混淆 Parcelable 子类 -keepclassmembers class * implements android.os.Parcelable { public static final android.os.Parcelable$Creator CREATOR; } # 不混淆 Serializable 子类 -keepclassmembers class * implements java.io.Serializable { static final long serialVersionUID; private static final java.io.ObjectStreamField[] serialPersistentFields; !static !transient ; !private ; !private ; private void writeObject(java.io.ObjectOutputStream); private void readObject(java.io.ObjectInputStream); java.lang.Object writeReplace(); java.lang.Object readResolve(); } # 不混淆 R 文件中的字段 -keepclassmembers class **.R$* { public static ; } # 不混淆 WebView 设置的 JS 接口的方法名 -keepclassmembers class * { @android.webkit.JavascriptInterface ; } # 禁止类名混淆,否则通过类名称找不到类 -keep class com.dolphin.core.entity.**{*;}