# ------------------------------------- # android 原始混淆模板 # ------------------------------------- # ---------------------------------- # 通过指定数量的优化能执行 # -optimizationpasses n # ---------------------------------- -optimizationpasses 5 # ---------------------------------- # 混淆时不会产生形形色色的类名 # -dontusemixedcaseclassnames # ---------------------------------- #-dontusemixedcaseclassnames # ---------------------------------- # 指定不去忽略非公共的库类 # -dontskipnonpubliclibraryclasses # ---------------------------------- #-dontskipnonpubliclibraryclasses # ---------------------------------- # 不预校验 # -dontpreverify # ---------------------------------- # -dontpreverify # ---------------------------------- # 输出生成信息 # -verbose # ---------------------------------- -verbose # ---------------------------------- # 优化选项 # optimizations {optimization_filter} # ---------------------------------- -optimizations !code/simplification/arithmetic,!field/*,!class/merging/* -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.app.backup.BackupAgentHelper -keep public class * extends android.preference.Preference -keep public class com.android.vending.licensing.ILicensingService -keepclasseswithmembernames class * { native ; } # ----------------- # modify 修改合并 # ----------------- -keep public class * extends android.view.View { public (android.content.Context); public (android.content.Context, android.util.AttributeSet); public (android.content.Context, android.util.AttributeSet, int); public void set*(...); } -keepclassmembers enum * { public static **[] values(); public static ** valueOf(java.lang.String); } -keep class * implements android.os.Parcelable { public static final android.os.Parcelable$Creator *; } #-------------------------- # 保护类型 -keepattributes 说明 # Exceptions, Signature, Deprecated, SourceFile, SourceDir, LineNumberTable, LocalVariableTable, # LocalVariableTypeTable, Synthetic, EnclosingMethod, RuntimeVisibleAnnotations, RuntimeInvisibleAnnotations, # RuntimeVisibleParameterAnnotations, RuntimeInvisibleParameterAnnotations, and AnnotationDefault # -------------------- -keepattributes ** #-libraryjars /lib/rt.jar #for Gson -keepattributes Signature -keepattributes *Annotation* # Application classes that will be serialized/deserialized over Gson -keep class com.qiyou.mb.android.beans.basic.** { *; } -keep class com.qiyou.mb.android.utils.server.** { *; } ##---------------End: proguard configuration for Gson ---------- # ---------------------- # 不压缩指定的文件 # -dontshrink # ---------------------- #-dontshrink # 不优化指定的文件 # -dontoptimize # ----------------------- -dontoptimize # 不混淆指定的文件 # -dontobfuscate # ----------------------- # ----- 混淆包路径 ------- -repackageclasses '' -flattenpackagehierarchy '' -target 1.6 # -------- 以下是使用了 roboguice-1.1.2.jar 以及 guice-2.0-no_app.jar 功能需要保护的字段及类相关 -------- -keep class com.google.inject.Binder # ----------------------- -keepclassmembers class * { @com.google.inject.Inject (...); } -keepclassmembers class * { void *(**On*Event); } -keepclassmembers class **.R$* { public static ; } # ------ 编译时需要用到的 jar 包 # -libraryjars libs/baidumapapi_v2_3_0.jar # -libraryjars libs/baidumapapi_v2_4_2.jar # -libraryjars libs/locSDK_3.1.jar # -libraryjars libs/BaiduLBS_Android.jar # ------ 保护 谷歌第三方 jar 包,界面特效 ---------- -keep class com.google.** { *; } -keep class android.support.v4.** -dontwarn android.support.v4.** #zxing scan -keep class me.dm7.barcodescanner.** { *; } -dontwarn com.google.zxing.** # ------ 保护百度地址jar包 -------- -keep class com.baidu.** { *; } -keep class vi.com.gdi.bgl.android.**{*;} -dontwarn com.baidu.** # imgage load -keep class com.nostra13.universalimageloader.** { *; } # --- 打包时忽略以下类的警告 -- -dontwarn com.classpackage.AA #-keepnames class * implements java.io.Serializable # ---------保护所有实体中的字段名称---------- -keepclassmembers class * implements java.io.Serializable { ; } # --------- 保护类中的所有方法名 ------------ -keepclassmembers class * { public ; } -assumenosideeffects class android.util.Log { public static *** d(...); public static *** v(...); } -dontwarn com.iflytek.** -keepattributes Signature #-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 class com.iflytek.**{*;} -keep class * extends java.util.ListResourceBundle { protected Object[][] getContents(); } -keep public class com.google.android.gms.common.internal.safeparcel.SafeParcelable { public static final *** NULL; } -keepnames @com.google.android.gms.common.annotation.KeepName class * -keepclassmembernames class * { @com.google.android.gms.common.annotation.KeepName *; } -keepnames class * implements android.os.Parcelable { public static final ** CREATOR; } -dontshrink -dontoptimize -dontwarn com.google.android.maps.** -dontwarn android.webkit.WebView -dontwarn com.umeng.** -dontwarn com.tencent.weibo.sdk.** -dontwarn com.facebook.** -dontwarn com.taobao.** -dontwarn anet.channel.** -dontwarn anetwork.channel.** -dontwarn org.android.** -dontwarn org.apache.thrift.** -dontwarn com.xiaomi.** -dontwarn com.huawei.** -keep class com.taobao.** {*;} -keep class org.android.** {*;} -keep class anet.channel.** {*;} -keep class com.umeng.** {*;} -keep class com.xiaomi.** {*;} -keep class com.huawei.** {*;} -keep class org.apache.thrift.** {*;} -keep class com.alibaba.sdk.android.**{*;} -keep class com.ut.**{*;} -keep class com.ta.**{*;} -keep public class **.R$*{ public static final int *; } #-libraryjars libs/SocialSDK_QQZone_2.jar -keep enum com.facebook.** -keepattributes Exceptions,InnerClasses,Signature -keepattributes *Annotation* -keepattributes SourceFile,LineNumberTable -keep public interface com.facebook.** -keep public interface com.tencent.** -keep public interface com.umeng.socialize.** -keep public interface com.umeng.socialize.sensor.** -keep public interface com.umeng.scrshot.** -keep public class com.umeng.socialize.* {*;} -keep public class javax.** -keep public class android.webkit.** -keep class com.facebook.** -keep class com.umeng.scrshot.** -keep public class com.tencent.** {*;} -keep class com.umeng.socialize.sensor.** -keep class com.tencent.mm.sdk.modelmsg.WXMediaMessage {*;} -keep class com.tencent.mm.sdk.modelmsg.** implements com.tencent.mm.sdk.modelmsg.WXMediaMessage$IMediaObject {*;} -keep class im.yixin.sdk.api.YXMessage {*;} -keep class im.yixin.sdk.api.** implements im.yixin.sdk.api.YXMessage$YXMessageData{*;} -keep public class [com.qiyou.mb.android].R$*{ public static final int *; } -keepclassmembers class * { public (org.json.JSONObject); } # 以下类过滤不混淆 -keep public class * extends com.umeng.** # 以下包不进行过滤 -keep class com.umeng.** { *; } # Keep our interfaces so they can be used by other ProGuard rules. # See http://sourceforge.net/p/proguard/bugs/466/ -keep,allowobfuscation @interface com.facebook.proguard.annotations.DoNotStrip -keep,allowobfuscation @interface com.facebook.proguard.annotations.KeepGettersAndSetters # Do not strip any method/class that is annotated with @DoNotStrip -keep @com.facebook.proguard.annotations.DoNotStrip class * -keepclassmembers class * { @com.facebook.proguard.annotations.DoNotStrip *; } -keepclassmembers @com.facebook.proguard.annotations.KeepGettersAndSetters class * { void set*(***); *** get*(); }