Commit 7aa07a47 authored by mengcuiguang's avatar mengcuiguang

添加混淆

parent ae4f16bb
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
# By default, the flags in this file are appended to flags specified
# in /Users/mengcuiguang/Documents/softwareDevelopment/android-sdk-macosx/tools/proguard/proguard-android.txt
# You can edit the include path and order by changing the proguardFiles
# directive in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# Add any project specific keep options here:
# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
......@@ -12,10 +16,408 @@
# public *;
#}
# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable
#指定代码的压缩级别
-optimizationpasses 5
#包明不混合大小写
-dontusemixedcaseclassnames
#不去忽略非公共的库类
-dontskipnonpubliclibraryclasses
#优化 不优化输入的类文件
-dontoptimize
#预校验
-dontpreverify
#混淆时是否记录日志
-verbose
# 混淆时所采用的算法
-optimizations !code/simplification/arithmetic,!field/*,!class/merging/*
#保护注解
-keepattributes *Annotation*
#保护内部类 保护反射
-keepattributes Exceptions, Signature, InnerClasses ,EnclosingMethod
# 保持哪些类不被混淆
-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.data.BroadcastReceiver
-keep public class * extends android.data.ContentProvider
-keep public class * extends android.app.backup.BackupAgentHelper
-keep public class * extends android.preference.Preference
-keep public class com.android.vending.licensing.ILicensingService
#如果有引用v4包可以添加下面这行
-keep public class * extends android.support.v4.app.Fragment
#忽略警告
-ignorewarnings
##记录生成的日志数据,gradle build时在本项目根目录输出##
#apk 包内所有 class 的内部结构
-dump class_files.txt
#未混淆的类和成员
-printseeds seeds.txt
#列出从 apk 中删除的代码
-printusage unused.txt
#混淆前后的映射
-printmapping mapping.txt
########记录生成的日志数据,gradle build时 在本项目根目录输出-end######
# ===================== 混淆保护自己项目的部分代码以及引用的第三方jar包library ================
#okhttp
-dontwarn com.squareup.okhttp.**
-keep class com.squareup.okhttp.** { *;}
-dontwarn okio.**
#butterknife
-keep class butterknife.** { *; }
-dontwarn butterknife.internal.**
-keep class **$$ViewBinder { *; }
-keepclasseswithmembernames class * {
@butterknife.* <fields>;
}
-keepclasseswithmembernames class * {
@butterknife.* <methods>;
}
#忽略警告
-dontwarn retrofit.**
#保留一个完整的包
-keep class retrofit.** {
*;
}
#忽略警告
-dontwarn rx.internal.util.unsafe.**
#保留一个完整的包
-keep class rx.internal.util.unsafe.** {
*;
}
#忽略警告
-dontwarn uk.co.senab.photoview.**
#保留一个完整的包
-keep class uk.co.senab.photoview.** {
*;
}
#忽略警告
-dontwarn rx.internal.util.unsafe.**
#保留一个完整的包
-keep class rx.internal.util.unsafe.** {
*;
}
#忽略警告
-dontwarn com.mints.street.bean.**
#保留实体类
-keep class com.mints.street.bean.** {
*;
}
#忽略警告
-dontwarn com.mints.street.widget.**
#保留实体类
-keep class com.mints.street.widget.** {
*;
}
#系统的design 忽略警告
-dontwarn android.support.design.widget.**
#保留实体类
-keep class android.support.design.widget.** {
*;
}
#系统的renderscript 忽略警告
-dontwarn android.support.v8.renderscript.**
#保留实体类
-keep class android.support.v8.renderscript.** {
*;
}
#忽略警告
-dontwarn cn.com.library.rxbus.**
#保留实体类
-keep class cn.com.library.rxbus.** {*;}
#忽略警告 /高德
-dontwarn com.amap.api.**
-dontwarn com.autonavi.aps.amapapi.model.**
-dontwarn com.loc.**
#保留一个完整的包
-keep class com.amap.api.** {*;}
-keep class com.autonavi.aps.amapapi.model.** {*;}
-keep class com.loc.** {*;}
#忽略警告
-dontwarn cn.fraudmetrix.sdk.**
#保留一个完整的包
-keep class cn.fraudmetrix.sdk.** {
*;
}
#忽略警告
-dontwarn com.nineoldandroids.**
#保留一个完整的包
-keep class com.nineoldandroids.** {
*;
}
#忽略警告
-dontwarn Decoder.**
#保留一个完整的包
-keep class Decoder.** {
*;
}
#忽略警告
-dontwarn com.nostra13.universalimageloader.**
#保留实体类
-keep class com.nostra13.universalimageloader.** {
*;
}
#忽略警告
-dontwarn com.megvii.**
#保留实体类
-keep class com.megvii.** { *; }
-dontwarn cn.jpush.**
-keep class cn.jpush.** { *; }
#如果引用了v4或者v7包
-dontwarn android.support.**
#如果用用到Gson解析包的,直接添加下面这几行就能成功混淆,不然会报错。
#gson
-keepattributes Signature
# Gson specific classes
-keep class sun.misc.Unsafe { *; }
# Application classes that will be serialized/deserialized over Gson
-keep class com.google.gson.examples.android.model.** { *; }
# ===================== 混淆保护自己项目的部分代码以及引用的第三方jar包library-end ================
-keep public class * extends android.view.View {
public <init>(android.data.Context);
public <init>(android.data.Context, android.util.AttributeSet);
public <init>(android.data.Context, android.util.AttributeSet, int);
public void set*(...);
}
#保持 native 方法不被混淆
-keepclasseswithmembernames class * {
native <methods>;
}
#保持自定义控件类不被混淆
-keepclasseswithmembers class * {
public <init>(android.data.Context, android.util.AttributeSet);
}
#保持自定义控件类不被混淆
-keepclassmembers class * extends android.app.Activity {
public void *(android.view.View);
}
#保持 Parcelable 不被混淆
-keep class * implements android.os.Parcelable {
public static final android.os.Parcelable$Creator *;
}
#保持 Serializable 不被混淆
-keepnames class * implements java.io.Serializable
#保持 Serializable 不被混淆并且enum 类也不被混淆
-keepclassmembers class * implements java.io.Serializable {
static final long serialVersionUID;
private static final java.io.ObjectStreamField[] serialPersistentFields;
!static !transient <fields>;
!private <fields>;
!private <methods>;
private void writeObject(java.io.ObjectOutputStream);
private void readObject(java.io.ObjectInputStream);
java.lang.Object writeReplace();
java.lang.Object readResolve();
}
#保持枚举 enum 类不被混淆 如果混淆报错,建议直接使用上面的 -keepclassmembers class * implements java.io.Serializable即可
-keepclassmembers enum * {
public static **[] values();
public static ** valueOf(java.lang.String);
}
-keepclassmembers class * {
public void *ButtonClicked(android.view.View);
}
#不混淆资源类
-keepclassmembers class **.R$* {
public static <fields>;
}
# 避免影响升级功能,需要keep住support包的类
-keep class android.support.**{*;}
# ===================== shareSDK START ================
-dontwarn com.mob.**
-dontwarn cn.sharesdk.**
-dontwarn **.R$*
-keep class cn.sharesdk.**{*;}
-keep class com.sina.**{*;}
-keep class **.R$* {*;}
-keep class **.R{*;}
-keep class com.mob.**{*;}
# ======================= shareSDK END ===============
# ===================== umeng START ================
-keep class com.umeng.** {*;}
-keepclassmembers class * {
public <init> (org.json.JSONObject);
}
-keepclassmembers enum * {
public static **[] values();
public static ** valueOf(java.lang.String);
}
-keep public class com.mints.camera.R$*{
public static final int *;
}
-keep class com.uc.crashsdk.** { *; }
-keep interface com.uc.crashsdk.** { *; }
-keep class com.efs.** { *; }
-keep interface com.efs.** { *; }
# ======================= umeng END ================
# ===================== OAID START ================
-keep class XI.CA.XI.**{*;}
-keep class XI.K0.XI.**{*;}
-keep class XI.XI.K0.**{*;}
-keep class XI.vs.K0.**{*;}
-keep class XI.xo.XI.XI.**{*;}
-keep class com.asus.msa.SupplementaryDID.**{*;}
-keep class com.asus.msa.sdid.**{*;}
-keep class com.bun.lib.**{*;}
-keep class com.bun.miitmdid.**{*;}
-keep class com.huawei.hms.ads.identifier.**{*;}
-keep class com.samsung.android.deviceidservice.**{*;}
-keep class org.json.**{*;}
-keep public class com.netease.nis.sdkwrapper.Utils {public <methods>;}
# ======================= OAID END ================
# ===================== bugly START ================
-dontwarn com.tencent.bugly.**
-keep public class com.tencent.bugly.**{*;}
# ======================= bugly END ================
# ======================= 穿山甲 GroMore START ================
#pangle
-keep class com.bytedance.sdk.openadsdk.** { *; }
-keep public interface com.bytedance.sdk.openadsdk.downloadnew.** {*;}
-keep class com.pgl.sys.ces.* {*;}
#聚合混淆
-keep class bykvm*.**
-keep class com.bytedance.msdk.adapter.**{ public *; }
-keep class com.bytedance.msdk.api.** {
public *;
}
-keep class com.bytedance.msdk.base.TTBaseAd{*;}
-keep class com.bytedance.msdk.adapter.TTAbsAdLoaderAdapter{
public *;
protected <fields>;
}
# baidu sdk 不接入baidu sdk可以不引入
-keepclassmembers enum * {
public static **[] values();
public static ** valueOf(java.lang.String);
}
-keep class com.baidu.mobads.** { *; }
-keep class com.baidu.mobad.** { *; }
-keep class com.bun.miitmdid.core.** {*;}
#ks 快手 不接入ks sdk可以不引入
-keep class org.chromium.** {*;}
-keep class org.chromium.** { *; }
-keep class aegon.chrome.** { *; }
-keep class com.kwai.**{ *; }
-dontwarn com.kwai.**
-dontwarn com.kwad.**
-dontwarn com.ksad.**
-dontwarn aegon.chrome.**
# Admob 不接入admob sdk可以不引入
-keep class com.google.android.gms.ads.MobileAds {
public *;
}
#sigmob 不接入sigmob sdk可以不引入
-dontwarn android.support.v4.**
-keep class android.support.v4.** { *; }
-keep interface android.support.v4.** { *; }
-keep public class * extends android.support.v4.**
-keep class sun.misc.Unsafe { *; }
-dontwarn com.sigmob.**
-keep class com.sigmob.**.**{*;}
# ======================= 穿山甲 GroMore END ================
# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment