混淆规则

-ignorewarnings

# 指定代码的压缩级别
-optimizationpasses 5
# 不使用大小写混合
-dontusemixedcaseclassnames
# 混淆第三方jar
-dontskipnonpubliclibraryclasses
# 混淆时不做预校验
-dontpreverify
 # 混淆时记录日志
-verbose
 # 混淆时所采用的算法
-optimizations !code/simplification/arithmetic,!field/*,!class/merging/*
-dontshrink
-dontoptimize


 # 保持哪些类不被混淆:四大组件,应用类,配置类等等
-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
#-keep public class * extends android.support.v4.app.Fragment
-keep public class * extends com.cqgk.clerk.base.BusinessBaseActivity
-keep public class * extends com.cqgk.clerk.base.BusinessBaseFragment
-keep public class * extends com.cqgk.clerk.config.**{*;}
-keep public class com.cqgk.clerk.bean.**{*;}

#高德地图API 混淆代码
-keep class com.amap.api.location.**{*;}
-keep class com.amap.api.fence.**{*;}
-keep class com.autonavi.aps.amapapi.model.**{*;}

#webview方法 不被混淆
-keepclassmembers class * extends android.webkit.WebChromeClient {
    public void openFileChooser(...);
    public void onShowFileChooser(...);
}

# 保持 native 方法不被混淆
-keepclasseswithmembernames class * {
    native ;
}

 # 保持自定义控件类不被混淆
-keepclasseswithmembers class * {
    public (android.content.Context, android.util.AttributeSet);
}

 # 保持自定义控件类不被混淆
-keepclasseswithmembers class * {
    public (android.content.Context, android.util.AttributeSet, int);
}

 # 保持自定义控件类不被混淆
-keepclassmembers class * extends android.app.Activity {
   public void *(android.view.View);
}

 # 保持枚举 enum 类不被混淆
-keepclassmembers enum * {
    public static **[] values();
    public static ** valueOf(java.lang.String);
}

 # 保持 Parcelable 不被混淆
-keep class * implements android.os.Parcelable {
  public static final android.os.Parcelable$Creator *;
}
 # 这个主要是在layout中写的onclick方法android:οnclick="onClick",不进行混淆
 -keepclassmembers class * extends android.app.Activity {
   public void *(android.view.View);
 }

 #保持注解
 -keepattributes *Annotation*

 #不混淆org.apache.http.legacy.jar
 -dontwarn android.net.compatibility.**
 -dontwarn android.net.http.**
 -dontwarn com.android.internal.http.multipart.**
 -dontwarn org.apache.commons.**
 -dontwarn org.apache.http.**
 -keep class android.net.compatibility.**{*;}
 -keep class android.net.http.**{*;}
 -keep class com.android.internal.http.multipart.**{*;}
 -keep class org.apache.commons.**{*;}
 -keep class org.apache.http.**{*;}

 #xutils库
 #-libraryjars libs/xutils-3.3.22.aar
 -keep class org.xutils.** { *; }

#百度语音混淆
-keep class vi.com.gdi.bgl.**{*;}
-keep class com.baidu.**{*;}
-keep class com.baidu.tts.**{*;}
-keep class com.baidu.tts.client.**{*;}
-keep class com.baidu.tts.client.SpeechSynthesizer.**{*;}
-keep class com.baidu.tts.jni.EmbeddedSynthesizerEngine{*;}

#友盟分享组件
 -dontwarn com.google.android.maps.**
 -dontwarn android.webkit.WebView
 -dontwarn com.umeng.**
 -dontwarn com.tencent.weibo.sdk.**
 -dontwarn com.facebook.*
 -dontwarn com.ligeit.cellar.bean.**


 -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.facebook.** { *; }
 -keep class com.umeng.scrshot.**
 -keep public class com.tencent.** {*;}
 -keep class com.umeng.socialize.sensor.**
 -keep class com.umeng.socialize.handler.**
 -keep class com.umeng.socialize.handler.*
 -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{*;}

 -dontwarn twitter4j.**
 -keep class twitter4j.** { *; }

 -keep class com.tencent.** {*;}
 -dontwarn com.tencent.**
 -keep public class com.umeng.soexample.R$*{
     public static final int *;
 }
 -keep public class com.umeng.soexample.R$*{
     public static final int *;
 }
 -keep class com.tencent.open.TDialog$*
 -keep class com.tencent.open.TDialog$* {*;}
 -keep class com.tencent.open.PKDialog
 -keep class com.tencent.open.PKDialog {*;}
 -keep class com.tencent.open.PKDialog$*
 -keep class com.tencent.open.PKDialog$* {*;}

 -keep class com.sina.** {*;}
 -dontwarn com.sina.**
 -keep class  com.alipay.share.sdk.** {
    *;
 }
 -keepnames class * implements android.os.Parcelable {
     public static final ** CREATOR;
 }

#APP用户统计混淆
 -keepclassmembers class * {
    public  (org.json.JSONObject);
 }
 -keep public class com.cqgk.clerk.R$*{
 public static final int *;
 }
 -keepclassmembers enum * {
     public static **[] values();
     public static ** valueOf(java.lang.String);
 }
#友盟分享组件end






-keepclassmembers enum * {
    public static **[] values();
    public static ** valueOf(java.lang.String);
}

#-libraryjars libs/alipaysdk.jar
#-libraryjars libs/alipaysecsdk.jar
#-libraryjars libs/alipayutdid.jar
#-libraryjars libs/AMap_Location_V2.6.0_20160628.jar
#-libraryjars libs/org.apache.http.legacy.jar
#-libraryjars libs/pulltorefresh.aar
#-libraryjars libs/SocialSDK_WeiXin_1.jar
#-libraryjars libs/SocialSDK_WeiXin_2.jar

转载于:https://my.oschina.net/fxflysky/blog/793007

你可能感兴趣的:(混淆规则)