Android 混淆总结(直接copy)(转)
转自:http://blog.csdn.net/u012188405/article/details/51985273
- # Add project specific ProGuard rules here.
- # By default, the flags in this file are appended to flags specified
- # in D:\android-sdk-windows/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 *;
- #}
- # copyright zhonghanwen
- #-------------------------------------------基本不用动区域--------------------------------------------
- #---------------------------------基本指令区----------------------------------
- -optimizationpasses 5
- -dontskipnonpubliclibraryclassmembers
- -printmapping proguardMapping.txt
- -optimizations !code/simplification/cast,!field/*,!class/merging/*
- -keepattributes *Annotation*,InnerClasses
- -keepattributes Signature
- -keepattributes SourceFile,LineNumberTable
- #----------------------------------------------------------------------------
- #---------------------------------默认保留区---------------------------------
- #继承activity,application,service,broadcastReceiver,contentprovider....不进行混淆
- -keep public class * extends android.app.Activity
- -keep public class * extends android.app.Application
- -keep public class * extends android.support.multidex.MultiDexApplication
- -keep public class * extends android.app.Service
- -keep public class * extends android.content.BroadcastReceiver
- -keep public class * extends android.content.ContentProvider
- -keep public class * extends android.app.backup.BackupAgentHelper
- -keep public class * extends android.preference.Preference
- -keep public class * extends android.view.View
- -keep public class com.android.vending.licensing.ILicensingService
- -keep class android.support.** {*;}
- -keep public class * extends android.view.View{
- *** get*();
- void set*(***);
- public <init>(android.content.Context);
- public <init>(android.content.Context, android.util.AttributeSet);
- public <init>(android.content.Context, android.util.AttributeSet, int);
- }
- -keepclasseswithmembers class * {
- public <init>(android.content.Context, android.util.AttributeSet);
- public <init>(android.content.Context, android.util.AttributeSet, int);
- }
- #这个主要是在layout 中写的onclick方法android:onclick="onClick",不进行混淆
- -keepclassmembers class * extends android.app.Activity {
- public void *(android.view.View);
- }
- -keepclassmembers class * 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();
- }
- -keep class **.R$* {
- *;
- }
- -keepclassmembers class * {
- void *(*Event);
- }
- -keepclassmembers enum * {
- public static **[] values();
- public static ** valueOf(java.lang.String);
- }
- -keep class * implements android.os.Parcelable {
- public static final android.os.Parcelable$Creator *;
- }
- #// natvie 方法不混淆
- -keepclasseswithmembernames class * {
- native <methods>;
- }
- #保持 Parcelable 不被混淆
- -keep class * implements android.os.Parcelable {
- public static final android.os.Parcelable$Creator *;
- }
- #----------------------------------------------------------------------------
- #---------------------------------webview------------------------------------
- -keepclassmembers class fqcn.of.javascript.interface.for.Webview {
- public *;
- }
- -keepclassmembers class * extends android.webkit.WebViewClient {
- public void *(android.webkit.WebView, java.lang.String, android.graphics.Bitmap);
- public boolean *(android.webkit.WebView, java.lang.String);
- }
- -keepclassmembers class * extends android.webkit.WebViewClient {
- public void *(android.webkit.WebView, jav.lang.String);
- }
- #----------------------------------------------------------------------------
- #---------------------------------------------------------------------------------------------------
- #---------------------------------实体类---------------------------------
- 修改成你对应的包名
- -keep class [your_pkg].** { *; }
- #---------------------------------第三方包-------------------------------
- #支付宝支付
- -keep class com.alipay.android.app.IAlixPay{*;}
- -keep class com.alipay.android.app.IAlixPay$Stub{*;}
- -keep class com.alipay.android.app.IRemoteServiceCallback{*;}
- -keep class com.alipay.android.app.IRemoteServiceCallback$Stub{*;}
- -keep class com.alipay.sdk.app.PayTask{ public *;}
- -keep class com.alipay.sdk.app.AuthTask{ public *;}
- -keep public class * extends android.os.IInterface
- #微信支付
- -keep class com.tencent.mm.sdk.openapi.WXMediaMessage {*;}
- -keep class com.tencent.mm.sdk.openapi.** implements com.tencent.mm.sdk.openapi.WXMediaMessage$IMediaObject {*;}
- -keep class com.tencent.wxop.** { *; }
- -dontwarn com.tencent.mm.**
- -keep class com.tencent.mm.**{*;}
- -keepclasseswithmembernames class ** {
- }
- -keepattributes Signature
- -keep class sun.misc.Unsafe { *; }
- -keep class com.taobao.** {*;}
- -keep class com.alibaba.** {*;}
- -keep class com.alipay.** {*;}
- -dontwarn com.taobao.**
- -dontwarn com.alibaba.**
- -dontwarn com.alipay.**
- -keep class com.ut.** {*;}
- -dontwarn com.ut.**
- -keep class com.ta.** {*;}
- -dontwarn com.ta.**
- -keep class anet.**{*;}
- -keep class org.android.spdy.**{*;}
- -keep class org.android.agoo.**{*;}
- -dontwarn anet.**
- -dontwarn org.android.spdy.**
- -dontwarn org.android.agoo.**
- -keepclasseswithmembernames class com.xiaomi.**{*;}
- -keep public class * extends com.xiaomi.mipush.sdk.PushMessageReceiver
- -dontwarn com.xiaomi.push.service.b
- -keep class org.apache.http.**
- -keep interface org.apache.http.**
- -dontwarn org.apache.**
- #okhttp3.x
- -dontwarn com.squareup.okhttp3.**
- -keep class com.squareup.okhttp3.** { *;}
- -dontwarn okio.**
- #sharesdk
- -keep class cn.sharesdk.**{*;}
- -keep class com.sina.**{*;}
- -keep class **.R$* {*;}
- -keep class **.R{*;}
- -keep class com.mob.**{*;}
- -dontwarn com.mob.**
- -dontwarn cn.sharesdk.**
- -dontwarn **.R$*
- ## nineoldandroids-2.4.0.jar
- -keep public class com.nineoldandroids.** {*;}
- ####################zxing#####################
- -keep class com.google.zxing.** {*;}
- -dontwarn com.google.zxing.**
- ##百度定位
- -keep class com.baidu.** {*;}
- -keep class vi.com.** {*;}
- -dontwarn com.baidu.**
- ## okhttp
- -dontwarn com.squareup.okhttp.**
- -keep class com.squareup.okhttp.{*;}
- #retrofit
- -dontwarn retrofit.**
- -keep class retrofit.** { *; }
- -keepattributes Signature
- -keepattributes Exceptions
- -dontwarn okio.**
- #recyclerview-animators
- -keep class jp.wasabeef.** {*;}
- -dontwarn jp.wasabeef.*
- #multistateview
- -keep class com.kennyc.view.** { *; }
- -dontwarn com.kennyc.view.*
- # universal-image-loader 混淆
- -dontwarn com.nostra13.universalimageloader.**
- -keep class com.nostra13.universalimageloader.** { *; }
- #ormlite
- -keep class com.j256.**
- -keepclassmembers class com.j256.** { *; }
- -keep enum com.j256.**
- -keepclassmembers enum com.j256.** { *; }
- -keep interface com.j256.**
- -keepclassmembers interface com.j256.** { *; }
- #umeng
- # ========= 友盟 =================
- -dontshrink
- -dontoptimize
- -dontwarn com.google.android.maps.**
- -dontwarn android.webkit.WebView
- -dontwarn com.umeng.**
- -dontwarn com.tencent.weibo.sdk.**
- -dontwarn com.facebook.**
- -keep enum com.facebook.**
- -keepattributes Exceptions,InnerClasses,Signature
- -keepattributes *Annotation*
- -keepattributes SourceFile,LineNumberTable
- -keep public interface com.facebook.**
- -keep public interface com.tencent.**
- -keep public interface com.umeng.socialize.**
- -keep public interface com.umeng.socialize.sensor.**
- -keep public interface com.umeng.scrshot.**
- -keep public class com.umeng.socialize.* {*;}
- -keep public class javax.**
- -keep public class android.webkit.**
- -keep class com.facebook.**
- -keep class com.umeng.scrshot.**
- -keep public class com.tencent.** {*;}
- -keep class com.umeng.socialize.sensor.**
- -keep class com.tencent.mm.sdk.modelmsg.WXMediaMessage {*;}
- -keep class com.tencent.mm.sdk.modelmsg.** implements com.tencent.mm.sdk.modelmsg.WXMediaMessage$IMediaObject {*;}
- -keep class im.yixin.sdk.api.YXMessage {*;}
- -keep class im.yixin.sdk.api.** implements im.yixin.sdk.api.YXMessage$YXMessageData{*;}
- 下面中括号的地方需要要填你的包名
- -keep public class [your_pkg].R$*{
- public static final int *;
- }
- -keepclassmembers class * {
- public <init> (org.json.JSONObject);
- }
- -keepclassmembers enum * {
- public static **[] values();
- public static ** valueOf(java.lang.String);
- }
- #友盟自动更新
- -keep public class com.umeng.fb.ui.ThreadView {
- }
- -keep public class * extends com.umeng.**
- # 以下包不进行过滤
- -keep class com.umeng.** { *; }
- #-ButterKnife 7.0
- -keep class butterknife.** { *; }
- -dontwarn butterknife.internal.**
- -keep class **$$ViewBinder { *; }
- -keepclasseswithmembernames class * {
- @butterknife.* <fields>;
- }
- -keepclasseswithmembernames class * {
- @butterknife.* <methods>;
- }
- #AndFix
- -keep class * extends java.lang.annotation.Annotation
- -keepclasseswithmembernames class * {
- native <methods>;
- }
- #eventbus 3.0
- -keepattributes *Annotation*
- -keepclassmembers class ** {
- @org.greenrobot.eventbus.Subscribe <methods>;
- }
- -keep enum org.greenrobot.eventbus.ThreadMode { *; }
- -keepclassmembers class * extends org.greenrobot.eventbus.util.ThrowableFailureEvent {
- <init>(java.lang.Throwable);
- }
- #EventBus
- -keepclassmembers class ** {
- public void onEvent*(**);
- }
- -keepclassmembers class ** {
- public void xxxxxx(**);
- }
- ################gson##################
- -keep class com.google.gson.** {*;}
- -keep class com.google.**{*;}
- -keep class sun.misc.Unsafe { *; }
- -keep class com.google.gson.stream.** { *; }
- -keep class com.google.gson.examples.android.model.** { *; }
- -keepclassmembers class * 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();
- }
- -keep public class * implements java.io.Serializable {*;}
- # support-v4
- #https://stackoverflow.com/questions/18978706/obfuscate-android-support-v7-widget-gridlayout-issue
- -dontwarn android.support.v4.**
- -keep class android.support.v4.app.** { *; }
- -keep interface android.support.v4.app.** { *; }
- -keep class android.support.v4.** { *; }
- # support-v7
- -dontwarn android.support.v7.**
- -keep class android.support.v7.internal.** { *; }
- -keep interface android.support.v7.internal.** { *; }
- -keep class android.support.v7.** { *; }
- # support design
- #@link http://stackoverflow.com/a/31028536
- -dontwarn android.support.design.**
- -keep class android.support.design.** { *; }
- -keep interface android.support.design.** { *; }
- -keep public class android.support.design.R$* { *; }
- #-------------------------------------------------------------------------
- # picasso
- -keep class com.squareup.picasso.** {*; }
- -dontwarn com.squareup.picasso.**
- #glide
- -keep public class * implements com.bumptech.glide.module.GlideModule
- -keep public enum com.bumptech.glide.load.resource.bitmap.ImageHeaderParser$** {
- **[] $VALUES;
- public *;
- }
- # # ######## greenDao混淆 ##########
- # # -------------------------------------------
- -keep class de.greenrobot.dao.** {*;}
- -keepclassmembers class * extends de.greenrobot.dao.AbstractDao {
- public static Java.lang.String TABLENAME;
- }
- -keep class **$Properties
- # # ############### volley混淆 ###############
- # # -------------------------------------------
- -keep class com.android.volley.** {*;}
- -keep class com.android.volley.toolbox.** {*;}
- -keep class com.android.volley.Response$* { *; }
- -keep class com.android.volley.Request$* { *; }
- -keep class com.android.volley.RequestQueue$* { *; }
- -keep class com.android.volley.toolbox.HurlStack$* { *; }
- -keep class com.android.volley.toolbox.ImageLoader$* { *; }
- #jpush极光推送
- -dontwarn cn.jpush.**
- -keep class cn.jpush.** { *; }
- #activeandroid
- -keep class com.activeandroid.** { *; }
- -dontwarn com.ikoding.app.biz.dataobject.**
- -keep public class com.ikoding.app.biz.dataobject.** { *;}
- -keepattributes *Annotation*
- #log4j
- -dontwarn org.apache.log4j.**
- -keep class org.apache.log4j.** { *;}
- #下面几行 是环信即时通信的代码混淆
- -keep class com.easemob.** {*;}
- -keep class org.jivesoftware.** {*;}
- -dontwarn com.easemob.**
- #融云
- -keepclassmembers class fqcn.of.javascript.interface.for.webview {
- public *;
- }
- -keepattributes Exceptions,InnerClasses
- -keep class io.rong.** {*;}
- -keep class * implements io.rong.imlib.model.MessageContent{*;}
- -keepattributes Signature
- -keepattributes *Annotation*
- -keep class sun.misc.Unsafe { *; }
- -keep class com.google.gson.examples.android.model.** { *; }
- -keepclassmembers class * extends com.sea_monster.dao.AbstractDao {
- public static java.lang.String TABLENAME;
- }
- -keep class **$Properties
- -dontwarn org.eclipse.jdt.annotation.**
- -keep class com.ultrapower.** {*;}
- #高徳地图
- -dontwarn com.amap.api.**
- -dontwarn com.a.a.**
- -dontwarn com.autonavi.**
- -keep class com.amap.api.** {*;}
- -keep class com.autonavi.** {*;}
- -keep class com.a.a.** {*;}
- #---------------------------------反射相关的类和方法-----------------------
- 在这下面写反射相关的类和方法,没有就不用写!
- #---------------------------------与js互相调用的类------------------------
- 在这下面写与js互相调用的类,没有就去掉这句话!
- #---------------------------------自定义View的类------------------------
- 在这下面写自定义View的类的类,没有就去掉这句话!
- #SuperID
- #由*郭宇翔*贡献混淆代码
- #作者Github地址:https://github.com/yourtion
- -keep class **.R$* {*;}
- -keep class com.isnc.facesdk.aty.**{*;}
- -keep class com.isnc.facesdk.**{*;}
- -keep class com.isnc.facesdk.common.**{*;}
- -keep class com.isnc.facesdk.net.**{*;}
- -keep class com.isnc.facesdk.view.**{*;}
- -keep class com.isnc.facesdk.viewmodel.**{*;}
- -keep class com.matrixcv.androidapi.face.**{*;}
- #retrofit2.x
- -dontwarn retrofit2.**
- -keep class retrofit2.** { *; }
- -keepattributes Signature
- -keepattributes Exceptions
- #Rxjava RxAndroid
- -dontwarn rx.*
- -dontwarn sun.misc.**
- -keepclassmembers class rx.internal.util.unsafe.*ArrayQueue*Field* {
- long producerIndex;
- long consumerIndex;
- }
- -keepclassmembers class rx.internal.util.unsafe.BaseLinkedQueueProducerNodeRef {
- rx.internal.util.atomic.LinkedQueueNode producerNode;
- }
- -keepclassmembers class rx.internal.util.unsafe.BaseLinkedQueueConsumerNodeRef {
- rx.internal.util.atomic.LinkedQueueNode consumerNode;
- }
- #litepal
- -dontwarn org.litepal.
- -keep class org.litepal.* { ; }
- -keep enum org.litepal.*
- -keep interface org.litepal. { ; }
- -keep public class extends org.litepal.
- -keepattributes Annotation
- -keepclassmembers class extends org.litepal.crud.DataSupport{;}
- #fastJson
- -dontwarn com.alibaba.fastjson.**
- -keep class com.alibaba.fastjson.** { *; }
Android 混淆总结(直接copy)(转)的更多相关文章
- android混淆那些事
写给Android开发者的混淆使用手册 综述 毫无疑问,混淆是打包过程中最重要的流程之一,在没有特殊原因的情况下,所有 app 都应该开启混淆. 首先,这里说的的混淆其实是包括了代码压缩.代码混淆以及 ...
- Android混淆打包配置总结
Android打包失败出现Proguard returned with error code 1. See console的错误 这个问题是由于代码混淆引起的,找不到引用包. 只需在你的proguar ...
- Android混淆那些事儿
博客: 安卓之家 微博: 追风917 CSDN: 蒋朋的家 简书: 追风917 博客园:追风917 # Android混淆 Android混淆是Android开发者经常使用的一种用于代码防止被反编译的 ...
- Android混淆、反编译以及反破解的简单回顾
=========================================================================虽然反编译很简单,也没下面说的那么复杂,不过还是转了过 ...
- Android 混淆那些事儿
本文来自于腾讯Bugly公众号(weixinBugly),未经作者同意,请勿转载,原文地址:https://mp.weixin.qq.com/s/WmJyiA3fDNriw5qXuoA9MA 作者:l ...
- android -------- 混淆打包报错(warning - InnerClass annotations are missing corresponding EnclosingMember annotations)
最近做Android混淆打包遇到一些问题,Android Sdutio 3.1 版本打包的 错误如下: Android studio warning - InnerClass annotations ...
- Android 混淆代码有关问题总结
Android 混淆代码问题总结 Android 混淆代码: 最快的方式: 1. 首先更新Android的SDK至最新版本,重新建立1个工程,把源码和资源及其他文件拷到新的工程里面. 2. 工程目录底 ...
- Android 混淆[学习笔记]
Android 混淆 Gradle的简介: http://www.flysnow.org/2015/03/30/manage-your-android-project-with-gradle.html ...
- 5分钟搞定android混淆(转)
转自:https://www.jianshu.com/p/f3455ecaa56e 前言 混淆是上线前挺重要的一个环节.android使用的ProGuard,可以起到压缩,混淆,预检,优化的作用.但是 ...
随机推荐
- mongodb 稀疏索引
稀疏索引(或者称间隙索引)就是只包含有索引字段的文档的条目,即使索引字段包含一个空值.也就是说间隙索引可以跳过那些索引键不存在的文档.因为他并非包含所有的文档,因此称为稀疏索引.与之相对的非稀疏索引或 ...
- java Map的四种遍历方式
1.这是最常见的并且在大多数情况下也是最可取的遍历方式,在键值都需要时使用. Map<Integer, Integer> map = new HashMap<Integer, Int ...
- STM32F103系列命名规则
对于STM32F103xxyy系列:第一个x代表引脚数:T-36pin,C-48pin,R-64pin,V-100pin,Z-144pin:第二个x代表Flash容量:6-32K,8-64K,B-12 ...
- PHP 利用 curl 发送 post get del put patch 请求
因为需要在 php 开发中对接其它接口需要用 php curl 去对接其它接口 我把他们封装成函数 希望能对大家有所帮助. 这里面是封装好的会自动把 data 进行转成 json 格式,同时解码成 p ...
- vue打包配置发布路径
目的:配置路径,让打包后的dist在本地可以打开. 方法:修改build文件夹下边的的webpack.dev.conf.js文件,找到devServer下边的publicPath,这个来源于confi ...
- (转)VirtualBox下安装CentOS7系统
转:https://www.cnblogs.com/hihtml5/p/8217062.html 本文假定你已经知道如何安装VirtualBox虚拟机软件,并且已经安装好了. 首先我们需要准备好cen ...
- (转)df命令
转:http://man.linuxde.net/df df命令用于显示磁盘分区上的可使用的磁盘空间.默认显示单位为KB.可以利用该命令来获取硬盘被占用了多少空间,目前还剩下多少空间等信息. 语法 d ...
- php面试专题---4、流程控制考点
php面试专题---4.流程控制考点 一.总结 一句话总结: 理解循环内部机制(指针操作),更易于记忆foreach的reset特性,分支结构中理解了switch...case的执行步骤(跳转表)也就 ...
- 【转】 Linux 的目录详解 (Linux基础一)
前言 转自: http://c.biancheng.net/view/2833.html 进行了一些提炼和修改. 学习 Linux,不仅限于学习各种命令,了解整个 Linux 文件系统的目录结构以及各 ...
- JDK 与 JRE
JDK就是Java Development Kit.简单的说JDK是面向开发人员使用的SDK,它提供了Java的开发环境和运行环境.SDK是Software Development Kit 一般指软件 ...