android代码混淆aar_android aar 混淆

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

}

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

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

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值