美文网首页安卓
Android混淆 - 常用框架

Android混淆 - 常用框架

作者: _九卿_ | 来源:发表于2018-11-01 17:02 被阅读17次
    不混淆指定的jar库
    -libraryjars class_path
    如:
    -libraryjars libs/BaiduLBS_Android.jar
    
    Android类
    -keep public class * extends android.app.Fragment
    -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.preference.Preference
    -keep public class * extends android.content.ContentProvider
    -keep public class * extends android.support.v4.**
    -keep public class * extends android.support.annotation.**
    -keep public class * extends android.support.v7.**
    -keepclassmembers public class * extends android.app.Activity{ *;}
    
    okio
    -keep class sun.misc.Unsafe { *; }
    -dontwarn java.nio.file.*
    -dontwarn org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement
    -dontwarn okio.**
    -keep class okio.**{*;}
    -keep interface okio.**{*;}
    
    Gson
    -keepattributes Signature
    -keepattributes *Annotation*
    -keep class sun.misc.Unsafe { *; }
    -keep class com.google.gson.** {*;}
    -keep class com.google.gson.JsonObject {*;}
    -keep class com.google.gson.stream.** { *; }
    # Application classes that will be serialized/deserialized over Gson 下面替换成自己的实体类
    -keep class com.demo.model.** { *; }//这里更换为自己所有的实体类
    
    Eventbus
    -keepattributes *Annotation*
    -keepclassmembers class * {
        @org.greenrobot.eventbus.Subscribe <methods>;
    }
    -keep enum org.greenrobot.eventbus.ThreadMode { *; }
    # Only required if you use AsyncExecutor
    -keepclassmembers class * extends org.greenrobot.eventbus.util.ThrowableFailureEvent {
        <init>(java.lang.Throwable);
    }
    -keepattributes EnclosingMethod
    
    微信支付
    -keep class com.tencent.mm.sdk.** {
       *;
    }
    
    环信客服
    -keep class com.hyphenate.** {*;}
    -dontwarn  com.hyphenate.**
    
    小米push
    -keep class [您的应用包名].push.MIPushMessageReceiver {*;}
    -keepclasseswithmembernames,includedescriptorclasses class com.xiaomi.**{*;}
    -ignorewarnings
    
    Bugtags
    -keepattributes LineNumberTable,SourceFile
    -keep class com.bugtags.library.** {*;}
    -dontwarn com.bugtags.library.**
    -keep class io.bugtags.** {*;}
    -dontwarn io.bugtags.**
    -dontwarn org.apache.http.**
    -dontwarn android.net.http.AndroidHttpClient
    
    友盟
    -keep class com.umeng.** {*;}
    -keepclassmembers class * {
       public <init> (org.json.JSONObject);
    }
    -keep public class [您的应用包名].R$*{
    public static final int *;
    }
    -keepclassmembers enum * {
        public static **[] values();
        public static ** valueOf(java.lang.String);
    }
    
    Glide
    -keep public class * implements com.bumptech.glide.module.GlideModule
    -keep public enum com.bumptech.glide.load.resource.bitmap.ImageHeaderParser$** {
        **[] $VALUES;
        public *;
    }
    
    Retrofit
    -keepattributes Signature
    -keepattributes Exceptions
    -dontwarn retrofit2.**
    -keep class retrofit2.** { *; }
    
    OkHttp3
    -keepattributes Signature
    -keepattributes *Annotation*
    -keep class okhttp3.** { *; }
    -keep interface okhttp3.** { *; }
    -dontwarn okhttp3.**
    
    React Native
    # 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
    -keep,allowobfuscation @interface com.facebook.common.internal.DoNotStrip
    
    # Do not strip any method/class that is annotated with @DoNotStrip
    -keep @com.facebook.proguard.annotations.DoNotStrip class *
    -keep @com.facebook.common.internal.DoNotStrip class *
    -keepclassmembers class * {
        @com.facebook.proguard.annotations.DoNotStrip *;
        @com.facebook.common.internal.DoNotStrip *;
    }
    
    -keepclassmembers @com.facebook.proguard.annotations.KeepGettersAndSetters class * {
      void set*(***);
      *** get*();
    }
    
    -keep class * extends com.facebook.react.bridge.JavaScriptModule { *; }
    -keep class * extends com.facebook.react.bridge.NativeModule { *; }
    -keepclassmembers,includedescriptorclasses class * { native <methods>; }
    -keepclassmembers class *  { @com.facebook.react.uimanager.UIProp <fields>; }
    -keepclassmembers class *  { @com.facebook.react.uimanager.annotations.ReactProp <methods>; }
    -keepclassmembers class *  { @com.facebook.react.uimanager.annotations.ReactPropGroup <methods>; }
    
    -dontwarn com.facebook.react.**
    
    # TextLayoutBuilder uses a non-public Android constructor within StaticLayout.
    # See libs/proxy/src/main/java/com/facebook/fbui/textlayoutbuilder/proxy for details.
    -dontwarn android.text.StaticLayout
    
    TONGDUN
    -dontwarn android.os.**
    -dontwarn com.android.internal.**
    -keep class cn.tongdun.android.**{*;}
    
    RxJava RxAndroid
    -dontwarn sun.misc.**
    -keepclassmembers class rx.internal.util.unsafe.*ArrayQueue*Field* {
       long producerIndex;
       long consumerIndex;
    }
    -keepclassmembers class rx.internal.util.unsafe.BaseLinkedQueueProducerNodeRef {
        rx.internal.util.atomic.LinkedQueueNode producerNode;
    }
    -keepclassmembers class rx.internal.util.unsafe.BaseLinkedQueueConsumerNodeRef {
        rx.internal.util.atomic.LinkedQueueNode consumerNode;
    }
    -dontnote rx.internal.util.PlatformDependent
    
    Butter Knife7.0
    -keep class butterknife.** { *; }
     -dontwarn butterknife.internal.**
     -keep class **$$ViewBinder { *; }
     -keepclasseswithmembernames class * {
      @butterknife.* <fields>;
     }
     -keepclasseswithmembernames class * {
     @butterknife.* <methods>;
     }
    
    pinyin4j
    -dontwarn net.soureceforge.pinyin4j.**
    -keep class net.sourceforge.pinyin4j.** { *;}
    -keep class com.hp.** { *;}
    
    banner
    -keep class com.youth.banner.** {
        *;
     }
    
    support.v4
    -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
    -dontwarn android.support.design.**
    -keep class android.support.design.** { *; }
    -keep interface android.support.design.** { *; }
    -keep public class android.support.design.R$* { *; }
    

    相关文章

      网友评论

        本文标题:Android混淆 - 常用框架

        本文链接:https://www.haomeiwen.com/subject/jhsxxqtx.html