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);

}

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

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

更多相关文章

  1. Android(安卓)Retrofit,Gson,Okhttp混淆
  2. 安卓简易计算器
  3. proguard ant 混淆
  4. Android(安卓)Wifi IP 设置
  5. proguard.cfg 配置文件
  6. Android(安卓)代码混淆exception解决办法
  7. android颜色对应的xml配置值,颜色表,颜色含义
  8. Android编译环境配置
  9. Android(安卓)Studio配置OpenCV

随机推荐

  1. 关于Handler导包问题
  2. Android中几种图像特效处理方法小结
  3. Android之国际化
  4. Android应用开发揭秘 第一章
  5. Android使用NotificationManager进行消息
  6. Android Asynchronous Http Client-Andro
  7. Android中Drawable Resource学习
  8. Android 解决tools:replace=android:appC
  9. 优秀的android开源项目
  10. Android灭亡论之Firefox OS操作系统出现