Android 混淆(我的模板)

2023-05-10 19:15:20 浏览数 (1)

代码语言:javascript复制
#-------------------------------------------定制化区域----------------------------------------------
#---------------------------------1.实体类---------------------------------

-keep class com.gieseckedevrient.convego.appworld.prod.bean.** { *; }

#-------------------------------------------------------------------------

#---------------------------------2.第三方包-------------------------------
#高德地图混淆
  -keep class com.amap.api.location.**{*;}
  -keep class com.amap.api.fence.**{*;}
  -keep class com.autonavi.aps.amapapi.model.**{*;}




#GreeDao 混淆配置
-keep class org.greenrobot.greendao.**{*;}
-keep public interface org.greenrobot.greendao.**
-keepclassmembers class * extends org.greenrobot.greendao.AbstractDao {
public static java.lang.String TABLENAME;
}
-keep class **$Properties
-keep class net.sqlcipher.database.**{*;}
-keep public interface net.sqlcipher.database.**
-dontwarn net.sqlcipher.database.**
-dontwarn org.greenrobot.greendao.**


#OKHttp 混淆配置

-dontwarn com.squareup.okhttp.**

-keep class com.squareup.okhttp.** { *;}

-dontwarn okio.**


-dontwarn com.handmark.pulltorefresh.library.**

-keep class com.handmark.pulltorefresh.library.** { *;}

-dontwarn com.handmark.pulltorefresh.library.extras.**

-keep class com.handmark.pulltorefresh.library.extras.** { *;}

-dontwarn com.handmark.pulltorefresh.library.internal.**

-keep class com.handmark.pulltorefresh.library.internal.** { *;}


#eventBus
-keepattributes *Annotation*
-keepclassmembers class ** {
    @org.greenrobot.eventbus.Subscribe <methods>;
}
-keep enum org.greenrobot.eventbus.ThreadMode { *; }
-keepclassmembers class * extends org.greenrobot.eventbus.util.ThrowableFailureEvent {
    <init>(java.lang.Throwable);
}

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

# JPUSH
-dontwarn cn.jpush.**

-keep class cn.jpush.** { *; }
#Nohttp
-dontwarn com.yolanda.nohttp.**
-keep class com.yolanda.nohttp.**{*;}

#guava
-dontwarn sun.misc.Unsafe


-dontwarn butterknife.internal.**
-keep class **$$ViewInjector { *; }
-keepnames class * { @butterknife.InjectView *;}

#piccasc
-dontwarn com.squareup.okhttp.**


-dontwarn com.lnt.rechargelibrary.**
-keep class com.lnt.rechargelibrary.** { *;}


-dontwarn com.google.common.**
-keep class com.google.common.** { *;}



#AMap3DMap

-dontwarn com.amap.api.**
-keep class com.amap.api.** { *;}

-dontwarn com.autonavi.**
-keep class com.autonavi.** { *;}


-dontwarn com.gieseckedevrient.gdbandlib.**
-keep class com.gieseckedevrient.gdbandlib.** { *;}


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


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


#unionpay
-dontwarn com.unionpay.**
-keep class com.unionpay.**{*;}


#unionpay
-dontwarn com.c.a.a.**
-keep class com.c.a.a.**{*;}

#unionpay
-dontwarn com.a.a.c.**
-keep class com.a.a.c.**{*;}

#unionpay
-dontwarn com.a.a.d.**
-keep class com.a.a.d.**{*;}

#unionpay
-dontwarn com.a.a.e.**
-keep class com.a.a.e.**{*;}

#unionpay
-dontwarn com.c.a.c.**
-keep class com.c.a.c.**{*;}


-dontwarn com.gieseckedevrient.gdtsmisdk.**
-keep class  com.gieseckedevrient.gdtsmisdk.** { *;}



##---------------Begin: proguard configuration for Gson  ----------
# Gson uses generic type information stored in a class file when working with fields. Proguard
# removes such information by default, so configure it to keep all of it.
-keepattributes Signature

# For using GSON @Expose annotation
-keepattributes *Annotation*

# Gson specific classes
-keep class sun.misc.Unsafe { *; }
-keep class com.google.gson.stream.** { *; }

# Application classes that will be serialized/deserialized over Gson

##---------------End: proguard configuration for Gson  ----------

# Explicitly preserve all serialization members. The Serializable interface
# is only a marker interface, so it wouldn't save them.
-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 public class * implements java.io.Serializable {*;}



#-------------------------------------------------------------------------

#---------------------------------3.与js互相调用的类------------------------



#-------------------------------------------------------------------------

#---------------------------------4.反射相关的类和方法-----------------------



#----------------------------------------------------------------------------
#---------------------------------------------------------------------------------------------------

#-------------------------------------------基本不用动区域--------------------------------------------
#---------------------------------基本指令区----------------------------------
-optimizationpasses 5
-dontusemixedcaseclassnames
-dontskipnonpubliclibraryclasses
-dontskipnonpubliclibraryclassmembers
-dontpreverify
-verbose
-printmapping proguardMapping.txt
-optimizations !code/simplification/cast,!field/*,!class/merging/*
-keepattributes *Annotation*,InnerClasses
-keepattributes Signature
-keepattributes SourceFile,LineNumberTable
#----------------------------------------------------------------------------

#---------------------------------默认保留区---------------------------------
-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);
}
#----------------------------------------------------------------------------

#---------------------------------webview------------------------------------
-keepclassmembers class fqcn.of.javascript.interface.for.Webview {
   public *;
}
-keepclassmembers class * extends android.webkit.WebViewClient {
    public void *(android.webkit.WebView, java.lang.String, android.graphics.Bitmap);
    public boolean *(android.webkit.WebView, java.lang.String);
}
-keepclassmembers class * extends android.webkit.WebViewClient {
    public void *(android.webkit.WebView, jav.lang.String);
}
#----------------------------------------------------------------------------
代码语言:javascript复制
第三方jar包 与其依赖包一直,都是直接 
 k-dontwarn xx.xx.** 
 -keep class xx.xx.*{;}

即可。

0 人点赞