173 lines
6.5 KiB
Plaintext
173 lines
6.5 KiB
Plaintext
#==================================【基本配置】==================================
|
||
# 代码混淆压缩比,在0~7之间,默认为5,一般不下需要修改
|
||
-optimizationpasses 5
|
||
# 混淆时不使用大小写混合,混淆后的类名为小写
|
||
# windows下的同学还是加入这个选项吧(windows大小写不敏感)
|
||
-dontusemixedcaseclassnames
|
||
# 指定不去忽略非公共的库的类
|
||
# 默认跳过,有些情况下编写的代码与类库中的类在同一个包下,并且持有包中内容的引用,此时就需要加入此条声明
|
||
-dontskipnonpubliclibraryclasses
|
||
# 指定不去忽略非公共的库的类的成员
|
||
-dontskipnonpubliclibraryclassmembers
|
||
# 不做预检验,preverify是proguard的四个步骤之一
|
||
# Android不需要preverify,去掉这一步可以加快混淆速度
|
||
-dontpreverify
|
||
# 有了verbose这句话,混淆后就会生成映射文件
|
||
-verbose
|
||
#apk 包内所有 class 的内部结构
|
||
-dump class_files.txt
|
||
#未混淆的类和成员
|
||
-printseeds seeds.txt
|
||
#列出从 apk 中删除的代码
|
||
-printusage unused.txt
|
||
#混淆前后的映射
|
||
-printmapping mapping.txt
|
||
# 指定混淆时采用的算法,后面的参数是一个过滤器
|
||
# 这个过滤器是谷歌推荐的算法,一般不改变
|
||
-optimizations !code/simplification/artithmetic,!field/*,!class/merging/*
|
||
# 保护代码中的Annotation不被混淆
|
||
# 这在JSON实体映射时非常重要,比如fastJson
|
||
-keepattributes *Annotation*
|
||
# 避免混淆泛型
|
||
# 这在JSON实体映射时非常重要,比如fastJson
|
||
-keepattributes Signature
|
||
# 抛出异常时保留代码行号
|
||
-keepattributes SourceFile,LineNumberTable
|
||
#忽略警告
|
||
|
||
|
||
|
||
|
||
# Add project specific ProGuard rules here.
|
||
# By default, the flags in this file are appended to flags specified
|
||
# in D:\adt-bundle-windows-x86-20130522\adt-bundle-windows-x86-20130522\sdk/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:
|
||
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
|
||
# public *;
|
||
#}
|
||
#########################################################################
|
||
|
||
# This is a configuration file for ProGuard.
|
||
# http://proguard.sourceforge.net/index.html#manual/usage.html
|
||
|
||
-dontusemixedcaseclassnames
|
||
-dontskipnonpubliclibraryclasses
|
||
-verbose
|
||
|
||
# Optimization is turned off by default. Dex does not like code run
|
||
# through the ProGuard optimize and preverify steps (and performs some
|
||
# of these optimizations on its own).
|
||
-dontoptimize
|
||
-dontpreverify
|
||
# Note that if you want to enable optimization, you cannot just
|
||
# include optimization flags in your own project configuration file;
|
||
# instead you will need to point to the
|
||
# "proguard-android-optimize.txt" file instead of this one from your
|
||
# project.properties file.
|
||
|
||
#-keepattributes *Annotation*
|
||
-keep public class com.google.vending.licensing.ILicensingService
|
||
-keep public class com.android.vending.licensing.ILicensingService
|
||
|
||
# For native methods, see http://proguard.sourceforge.net/manual/examples.html#native
|
||
-keepclasseswithmembernames class * {
|
||
native <methods>;
|
||
}
|
||
|
||
# keep setters in Views so that animations can still work.
|
||
# see http://proguard.sourceforge.net/manual/examples.html#beans
|
||
-keepclassmembers public class * extends android.view.View {
|
||
void set*(***);
|
||
*** get*();
|
||
}
|
||
|
||
# We want to keep methods in Activity that could be used in the XML attribute onClick
|
||
-keepclassmembers class * extends android.app.Activity {
|
||
public void *(android.view.View);
|
||
}
|
||
|
||
# For enumeration classes, see http://proguard.sourceforge.net/manual/examples.html#enumerations
|
||
-keepclassmembers enum * {
|
||
public static **[] values();
|
||
public static ** valueOf(java.lang.String);
|
||
}
|
||
|
||
-keepclassmembers class * implements android.os.Parcelable {
|
||
public static final android.os.Parcelable$Creator CREATOR;
|
||
}
|
||
|
||
-keepclassmembers class **.R$* {
|
||
public static <fields>;
|
||
}
|
||
|
||
# The support library contains references to newer platform versions.
|
||
# Don't warn about those in case this app is linking against an older
|
||
# platform version. We know about them, and they are safe.
|
||
-dontwarn android.support.**
|
||
# Understand the @Keep support annotation.
|
||
-keep class android.support.annotation.Keep
|
||
-keep @android.support.annotation.Keep class * {*;}
|
||
-keepclasseswithmembers class * {
|
||
@android.support.annotation.Keep <methods>;
|
||
}
|
||
-keepclasseswithmembers class * {
|
||
@android.support.annotation.Keep <fields>;
|
||
}
|
||
-keepclasseswithmembers class * {
|
||
@android.support.annotation.Keep <init>(...);
|
||
}
|
||
####################################################################### 下面是自定义的上面是原生带的
|
||
#引入依赖包rt.jar(jdk路径)(注意:如在makeJar的时候提示指定了两次,可以将其注释掉)
|
||
#-libraryjars 'E:\java\jdk1.8\jre\lib\rt.jar'
|
||
#引入依赖包android.jar(android SDK路径)(注意:如在makeJar的时候提示指定了两次,可以将其注释掉)
|
||
#-libraryjars 'D:\AndroidSDK\platforms\android-23\android.jar'
|
||
#忽略警告
|
||
-ignorewarnings
|
||
#不要压缩(这个必须,因为开启混淆的时候 默认 会把没有被调用的代码 全都排除掉)
|
||
-dontshrink
|
||
#避免混淆泛型 如果混淆报错建议关掉
|
||
-keepattributes Signature
|
||
# 继承activity,application,service,broadcastReceiver,contentprovider....不进行混淆
|
||
-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
|
||
#不混淆那些类 通用语法
|
||
-dontwarn okhttp3.**
|
||
-keep class okhttp3.**{*;}
|
||
-dontwarn okio.**
|
||
-keep class okio.** {*;}
|
||
-dontwarn com.okhttp.utils.**
|
||
-keep class com.okhttp.utils.**{*;}
|
||
#json
|
||
-dontwarn com.google.gson.**
|
||
-keep class com.google.gson.**{*;}
|
||
-keep class com.xxx.OKUtils.**{*;}
|
||
-keep class com.xxx.activity.**{*;}
|
||
#-keep class interface com.qpcf.mylibrary.**{*;}
|
||
-keep public class * extends com.qpcf.mylibrary.IweixincrmDex
|
||
#加上{*;} 可以保证类中所有变量和方法都不被混淆 所以 class xxx.**{*;} 可以确保该类所有部分都不被混淆
|
||
|
||
#保证类 方法不被混淆
|
||
-keepclassmembers class * extends{
|
||
public <methods>;
|
||
}
|
||
|
||
#### -- OkHttp --
|
||
#-dontwarn com.squareup.okhttp.internal.**
|
||
#### -- Apache Commons --
|
||
#-dontwarn org.apache.commons.logging.**
|
||
|
||
#-keep class * {
|
||
#public private *;
|
||
#} |