Release {
minifyEnabledtrue
consumerProguardFiles('proguard-rules.pro')
proguardFiles getDefaultProguardFile('proguard-android.txt'),'proguard-rules.pro'
}
# Add project specific ProGuard rules here.
# By default, the flags in this file are appended to flags specified
# in D:\android\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 *;
#}
# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable
# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile
#-------------------------------------------定制化区域----------------------------------------------
#---------------------------------1.实体类---------------------------------
-keepclass bean.** {*;}
-keepclass bean.requestbean.** {*;}
-keepclass bean.responsebean.** {*;}
-keepclass http.ResponseBean.** {*;}
#-------------------------------------------------------------------------
#---------------------------------2.第三方包-------------------------------
#retrofit2.0
# Platform calls Class.forName on types which do not exist on Android to determine platform.
-dontnoteretrofit2.Platform
# Platform used when running on Java 8 VMs. Will not be used at runtime.
-dontwarnretrofit2.Platform$Java8
# Retain generic type information for use by reflection by converters and adapters.
-keepattributesSignature
# Retain declared checked exceptions for use by a Proxy instance.
-keepattributesExceptions
#OkHttp3
-dontwarnokio.**
-dontwarnjavax.annotation.Nullable
-dontwarnjavax.annotation.ParametersAreNonnullByDefault
#Gson混淆配置
-keepattributesSignature
-keepattributes*Annotation*
-keepclass sun.misc.Unsafe {*;}
-keepclass com.google.gson.** {*;}
-keepclass com.google.gson.stream.** {*;}
#fastjson混淆配置
-dontwarncom.alibaba.fastjson.**
-keepclass com.alibaba.fastjson.** {*;}
#frx淆配置
-dontwarnsun.misc.**
-keepclassmembersclass rx.internal.util.unsafe.*ArrayQueue*Field* {
long producerIndex;
long consumerIndex;
}
-keepclassmembersclass rx.internal.util.unsafe.BaseLinkedQueueProducerNodeRef {
rx.internal.util.atomic.LinkedQueueNode producerNode;
}
-keepclassmembersclass rx.internal.util.unsafe.BaseLinkedQueueConsumerNodeRef {
rx.internal.util.atomic.LinkedQueueNode consumerNode;
}
-dontnoterx.internal.util.PlatformDependent
#-------------------------------------------------------------------------
#---------------------------------3.与js互相调用的类------------------------
#-------------------------------------------------------------------------
#---------------------------------4.反射相关的类和方法-----------------------
#----------------------------------------------------------------------------
#---------------------------------------------------------------------------------------------------
#-------------------------------------------基本不用动区域--------------------------------------------
#---------------------------------基本指令区----------------------------------
-optimizationpasses5
-dontusemixedcaseclassnames
-dontskipnonpubliclibraryclasses
-dontskipnonpubliclibraryclassmembers
-dontpreverify
-verbose
-printmappingproguardMapping.txt
-optimizations!code/simplification/cast,!field/*,!class/merging/*
-keepattributes*Annotation*,InnerClasses
-keepattributesSignature
-keepattributesSourceFile,LineNumberTable
#----------------------------------------------------------------------------
#---------------------------------默认保留区---------------------------------
-keeppublic class * extends android.app.Activity
-keeppublic class * extends android.app.Application
-keeppublic class * extends android.app.Service
-keeppublic class * extends android.content.BroadcastReceiver
-keeppublic class * extends android.content.ContentProvider
-keeppublic class * extends android.app.backup.BackupAgentHelper
-keeppublic class * extends android.preference.Preference
-keeppublic class * extends android.view.View
-keeppublic class com.android.vending.licensing.ILicensingService
-keepclass android.support.** {*;}
-keepclasseswithmembernamesclass * {
native ;
}
-keepclassmembersclass * extends android.app.Activity{
public void *(android.view.View);
}
-keepclassmembersenum * {
public static **[] values();
public static ** valueOf(java.lang.String);
}
-keeppublic class * extends android.view.View{
*** get*();
void set*(***);
public (android.content.Context);
public (android.content.Context, android.util.AttributeSet);
public (android.content.Context, android.util.AttributeSet, int);
}
-keepclasseswithmembersclass * {
public (android.content.Context, android.util.AttributeSet);
public (android.content.Context, android.util.AttributeSet, int);
}
-keepclass * implements android.os.Parcelable {
public static final android.os.Parcelable$Creator *;
}
-keepclassmembersclass * 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();
}
-keepclass **.R$* {
*;
}
-keepclassmembersclass * {
void *(**On*Event);
}
#----------------------------------------------------------------------------
#---------------------------------webview------------------------------------
-keepclassmembersclass fqcn.of.javascript.interface.for.Webview {
public *;
}
-keepclassmembersclass * extends android.webkit.WebViewClient {
public void *(android.webkit.WebView, java.lang.String, android.graphics.Bitmap);
public boolean *(android.webkit.WebView, java.lang.String);
}
-keepclassmembersclass * extends android.webkit.WebViewClient {
public void *(android.webkit.WebView, jav.lang.String);
}
#----------------------------------------------------------------------------
#---------------------------------------------------------------------------------------------------
网友评论