美文网首页android
Android 常用混淆

Android 常用混淆

作者: 风染墨 | 来源:发表于2017-03-12 13:41 被阅读90次

    基本的不需要混淆的

        -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 * extends android.view.View
        -keep public class com.android.vending.licensing.ILicensingService
        -keep class android.support.** {*;}
        
        -keepclasseswithmembernames class * {
            native <methods>;
        }
        -keepclassmembers class * extends android.app.Activity{
            public void *(android.view.View);
        }
        -keepclassmembers enum * {
            public static **[] values();
            public static ** valueOf(java.lang.String);
        }
        -keep public class * extends android.view.View{
            *** get*();
            void set*(***);
            public <init>(android.content.Context);
            public <init>(android.content.Context, android.util.AttributeSet);
            public <init>(android.content.Context, android.util.AttributeSet, int);
        }
        -keepclasseswithmembers class * {
            public <init>(android.content.Context, android.util.AttributeSet);
            public <init>(android.content.Context, android.util.AttributeSet, int);
        }
        -keep class * implements android.os.Parcelable {
          public static final android.os.Parcelable$Creator *;
        }
        -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 *(**On*Event);
        }
    

    实体类

        -keep class com.example.test.Bean.** { *; }
    

    Butter Knife

        #Butter Knife
        -keep class butterknife.** { *; }
        -dontwarn butterknife.internal.**
        -keep class **$$ViewBinder { *; }
        -keepclasseswithmembernames class * {
            @butterknife.* <fields>;
        }
        -keepclasseswithmembernames class * {
            @butterknife.* <methods>;
        }
    

    Retrofit

        # Retrofit
        -dontwarn  okhttp3.*
        -dontnote okhttp3.**
        -keep class okhttp3.* { *; }
        -dontnote retrofit2.**
        -dontwarn retrofit2.**
        -keep class retrofit2.** { *; }
        -keepattributes Signature
        -keepattributes Exceptions
    

    RxJava RxAndroid

        # 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;
        }
    

    Gson

        # Gson
        -keepattributes Signature
        -keepattributes *Annotation*
        -keep class com.google.gson.stream.** { *; }
        
    

    Glide

            # Glide
            -keep public class * implements com.bumptech.glide.module.GlideModule
            -keep public enum com.bumptech.glide.load.resource.bitmap.ImageHeaderParser$** {
              **[] $VALUES;
              public *;
            }
    

    dagger

        # dagger
        -dontwarn dagger.**
        -dontwarn com.squareup.javapoet.**
        -dontwarn com.google.common.**
        
    

    相关文章

      网友评论

        本文标题:Android 常用混淆

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