转自:http://blog.csdn.net/u012188405/article/details/51985273

  1. # Add project specific ProGuard rules here.
  2. # By default, the flags in this file are appended to flags specified
  3. # in D:\android-sdk-windows/tools/proguard/proguard-android.txt
  4. # You can edit the include path and order by changing the proguardFiles
  5. # directive in build.gradle.
  6. #
  7. # For more details, see
  8. # http://developer.android.com/guide/developing/tools/proguard.html
  9.  
  10. # Add any project specific keep options here:
  11.  
  12. # If your project uses WebView with JS, uncomment the following
  13. # and specify the fully qualified class name to the JavaScript interface
  14. # class:
  15. #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
  16. # public *;
  17. #}
  18. # copyright zhonghanwen
  19. #-------------------------------------------基本不用动区域--------------------------------------------
  20. #---------------------------------基本指令区----------------------------------
  21. -optimizationpasses 5
  22. -dontskipnonpubliclibraryclassmembers
  23. -printmapping proguardMapping.txt
  24. -optimizations !code/simplification/cast,!field/*,!class/merging/*
  25. -keepattributes *Annotation*,InnerClasses
  26. -keepattributes Signature
  27. -keepattributes SourceFile,LineNumberTable
  28. #----------------------------------------------------------------------------
  29.  
  30. #---------------------------------默认保留区---------------------------------
  31. #继承activity,application,service,broadcastReceiver,contentprovider....不进行混淆
  32. -keep public class * extends android.app.Activity
  33. -keep public class * extends android.app.Application
  34. -keep public class * extends android.support.multidex.MultiDexApplication
  35. -keep public class * extends android.app.Service
  36. -keep public class * extends android.content.BroadcastReceiver
  37. -keep public class * extends android.content.ContentProvider
  38. -keep public class * extends android.app.backup.BackupAgentHelper
  39. -keep public class * extends android.preference.Preference
  40. -keep public class * extends android.view.View
  41. -keep public class com.android.vending.licensing.ILicensingService
  42. -keep class android.support.** {*;}
  43.  
  44. -keep public class * extends android.view.View{
  45. *** get*();
  46. void set*(***);
  47. public <init>(android.content.Context);
  48. public <init>(android.content.Context, android.util.AttributeSet);
  49. public <init>(android.content.Context, android.util.AttributeSet, int);
  50. }
  51. -keepclasseswithmembers class * {
  52. public <init>(android.content.Context, android.util.AttributeSet);
  53. public <init>(android.content.Context, android.util.AttributeSet, int);
  54. }
  55. #这个主要是在layout 中写的onclick方法android:onclick="onClick",不进行混淆
  56. -keepclassmembers class * extends android.app.Activity {
  57. public void *(android.view.View);
  58. }
  59.  
  60. -keepclassmembers class * implements java.io.Serializable {
  61. static final long serialVersionUID;
  62. private static final java.io.ObjectStreamField[] serialPersistentFields;
  63. private void writeObject(java.io.ObjectOutputStream);
  64. private void readObject(java.io.ObjectInputStream);
  65. java.lang.Object writeReplace();
  66. java.lang.Object readResolve();
  67. }
  68. -keep class **.R$* {
  69. *;
  70. }
  71.  
  72. -keepclassmembers class * {
  73. void *(*Event);
  74. }
  75.  
  76. -keepclassmembers enum * {
  77. public static **[] values();
  78. public static ** valueOf(java.lang.String);
  79. }
  80. -keep class * implements android.os.Parcelable {
  81. public static final android.os.Parcelable$Creator *;
  82. }
  83. #// natvie 方法不混淆
  84. -keepclasseswithmembernames class * {
  85. native <methods>;
  86. }
  87.  
  88. #保持 Parcelable 不被混淆
  89. -keep class * implements android.os.Parcelable {
  90. public static final android.os.Parcelable$Creator *;
  91. }
  92.  
  93. #----------------------------------------------------------------------------
  94.  
  95. #---------------------------------webview------------------------------------
  96. -keepclassmembers class fqcn.of.javascript.interface.for.Webview {
  97. public *;
  98. }
  99. -keepclassmembers class * extends android.webkit.WebViewClient {
  100. public void *(android.webkit.WebView, java.lang.String, android.graphics.Bitmap);
  101. public boolean *(android.webkit.WebView, java.lang.String);
  102. }
  103. -keepclassmembers class * extends android.webkit.WebViewClient {
  104. public void *(android.webkit.WebView, jav.lang.String);
  105. }
  106. #----------------------------------------------------------------------------
  107. #---------------------------------------------------------------------------------------------------
  108. #---------------------------------实体类---------------------------------
  109. 修改成你对应的包名
  110. -keep class [your_pkg].** { *; }
  111.  
  112. #---------------------------------第三方包-------------------------------
  113.  
  114. #支付宝支付
  115. -keep class com.alipay.android.app.IAlixPay{*;}
  116. -keep class com.alipay.android.app.IAlixPay$Stub{*;}
  117. -keep class com.alipay.android.app.IRemoteServiceCallback{*;}
  118. -keep class com.alipay.android.app.IRemoteServiceCallback$Stub{*;}
  119. -keep class com.alipay.sdk.app.PayTask{ public *;}
  120. -keep class com.alipay.sdk.app.AuthTask{ public *;}
  121. -keep public class * extends android.os.IInterface
  122. #微信支付
  123. -keep class com.tencent.mm.sdk.openapi.WXMediaMessage {*;}
  124. -keep class com.tencent.mm.sdk.openapi.** implements com.tencent.mm.sdk.openapi.WXMediaMessage$IMediaObject {*;}
  125. -keep class com.tencent.wxop.** { *; }
  126. -dontwarn com.tencent.mm.**
  127. -keep class com.tencent.mm.**{*;}
  128. -keepclasseswithmembernames class ** {
  129. }
  130. -keepattributes Signature
  131.  
  132. -keep class sun.misc.Unsafe { *; }
  133.  
  134. -keep class com.taobao.** {*;}
  135. -keep class com.alibaba.** {*;}
  136. -keep class com.alipay.** {*;}
  137. -dontwarn com.taobao.**
  138. -dontwarn com.alibaba.**
  139. -dontwarn com.alipay.**
  140.  
  141. -keep class com.ut.** {*;}
  142. -dontwarn com.ut.**
  143.  
  144. -keep class com.ta.** {*;}
  145. -dontwarn com.ta.**
  146.  
  147. -keep class anet.**{*;}
  148. -keep class org.android.spdy.**{*;}
  149. -keep class org.android.agoo.**{*;}
  150. -dontwarn anet.**
  151. -dontwarn org.android.spdy.**
  152. -dontwarn org.android.agoo.**
  153.  
  154. -keepclasseswithmembernames class com.xiaomi.**{*;}
  155. -keep public class * extends com.xiaomi.mipush.sdk.PushMessageReceiver
  156.  
  157. -dontwarn com.xiaomi.push.service.b
  158.  
  159. -keep class org.apache.http.**
  160. -keep interface org.apache.http.**
  161. -dontwarn org.apache.**
  162.  
  163. #okhttp3.x
  164. -dontwarn com.squareup.okhttp3.**
  165. -keep class com.squareup.okhttp3.** { *;}
  166. -dontwarn okio.**
  167. #sharesdk
  168. -keep class cn.sharesdk.**{*;}
  169. -keep class com.sina.**{*;}
  170. -keep class **.R$* {*;}
  171. -keep class **.R{*;}
  172.  
  173. -keep class com.mob.**{*;}
  174. -dontwarn com.mob.**
  175. -dontwarn cn.sharesdk.**
  176. -dontwarn **.R$*
  177.  
  178. ## nineoldandroids-2.4.0.jar
  179. -keep public class com.nineoldandroids.** {*;}
  180.  
  181. ####################zxing#####################
  182. -keep class com.google.zxing.** {*;}
  183. -dontwarn com.google.zxing.**
  184. ##百度定位
  185. -keep class com.baidu.** {*;}
  186. -keep class vi.com.** {*;}
  187. -dontwarn com.baidu.**
  188.  
  189. ## okhttp
  190. -dontwarn com.squareup.okhttp.**
  191. -keep class com.squareup.okhttp.{*;}
  192. #retrofit
  193. -dontwarn retrofit.**
  194. -keep class retrofit.** { *; }
  195. -keepattributes Signature
  196. -keepattributes Exceptions
  197. -dontwarn okio.**
  198.  
  199. #recyclerview-animators
  200. -keep class jp.wasabeef.** {*;}
  201. -dontwarn jp.wasabeef.*
  202.  
  203. #multistateview
  204. -keep class com.kennyc.view.** { *; }
  205. -dontwarn com.kennyc.view.*
  206.  
  207. # universal-image-loader 混淆
  208. -dontwarn com.nostra13.universalimageloader.**
  209. -keep class com.nostra13.universalimageloader.** { *; }
  210.  
  211. #ormlite
  212. -keep class com.j256.**
  213. -keepclassmembers class com.j256.** { *; }
  214. -keep enum com.j256.**
  215. -keepclassmembers enum com.j256.** { *; }
  216. -keep interface com.j256.**
  217. -keepclassmembers interface com.j256.** { *; }
  218. #umeng
  219. # ========= 友盟 =================
  220. -dontshrink
  221. -dontoptimize
  222. -dontwarn com.google.android.maps.**
  223. -dontwarn android.webkit.WebView
  224. -dontwarn com.umeng.**
  225. -dontwarn com.tencent.weibo.sdk.**
  226. -dontwarn com.facebook.**
  227.  
  228. -keep enum com.facebook.**
  229. -keepattributes Exceptions,InnerClasses,Signature
  230. -keepattributes *Annotation*
  231. -keepattributes SourceFile,LineNumberTable
  232.  
  233. -keep public interface com.facebook.**
  234. -keep public interface com.tencent.**
  235. -keep public interface com.umeng.socialize.**
  236. -keep public interface com.umeng.socialize.sensor.**
  237. -keep public interface com.umeng.scrshot.**
  238.  
  239. -keep public class com.umeng.socialize.* {*;}
  240. -keep public class javax.**
  241. -keep public class android.webkit.**
  242.  
  243. -keep class com.facebook.**
  244. -keep class com.umeng.scrshot.**
  245. -keep public class com.tencent.** {*;}
  246. -keep class com.umeng.socialize.sensor.**
  247.  
  248. -keep class com.tencent.mm.sdk.modelmsg.WXMediaMessage {*;}
  249.  
  250. -keep class com.tencent.mm.sdk.modelmsg.** implements com.tencent.mm.sdk.modelmsg.WXMediaMessage$IMediaObject {*;}
  251.  
  252. -keep class im.yixin.sdk.api.YXMessage {*;}
  253. -keep class im.yixin.sdk.api.** implements im.yixin.sdk.api.YXMessage$YXMessageData{*;}
  254. 下面中括号的地方需要要填你的包名
  255. -keep public class [your_pkg].R$*{
  256. public static final int *;
  257. }
  258. -keepclassmembers class * {
  259. public <init> (org.json.JSONObject);
  260. }
  261. -keepclassmembers enum * {
  262. public static **[] values();
  263. public static ** valueOf(java.lang.String);
  264. }
  265.  
  266. #友盟自动更新
  267. -keep public class com.umeng.fb.ui.ThreadView {
  268. }
  269. -keep public class * extends com.umeng.**
  270. # 以下包不进行过滤
  271. -keep class com.umeng.** { *; }
  272.  
  273. #-ButterKnife 7.0
  274. -keep class butterknife.** { *; }
  275. -dontwarn butterknife.internal.**
  276. -keep class **$$ViewBinder { *; }
  277. -keepclasseswithmembernames class * {
  278. @butterknife.* <fields>;
  279. }
  280. -keepclasseswithmembernames class * {
  281. @butterknife.* <methods>;
  282. }
  283.  
  284. #AndFix
  285. -keep class * extends java.lang.annotation.Annotation
  286. -keepclasseswithmembernames class * {
  287. native <methods>;
  288. }
  289.  
  290. #eventbus 3.0
  291. -keepattributes *Annotation*
  292. -keepclassmembers class ** {
  293. @org.greenrobot.eventbus.Subscribe <methods>;
  294. }
  295. -keep enum org.greenrobot.eventbus.ThreadMode { *; }
  296. -keepclassmembers class * extends org.greenrobot.eventbus.util.ThrowableFailureEvent {
  297. <init>(java.lang.Throwable);
  298. }
  299.  
  300. #EventBus
  301. -keepclassmembers class ** {
  302. public void onEvent*(**);
  303. }
  304. -keepclassmembers class ** {
  305. public void xxxxxx(**);
  306. }
  307.  
  308. ################gson##################
  309. -keep class com.google.gson.** {*;}
  310. -keep class com.google.**{*;}
  311. -keep class sun.misc.Unsafe { *; }
  312. -keep class com.google.gson.stream.** { *; }
  313. -keep class com.google.gson.examples.android.model.** { *; }
  314.  
  315. -keepclassmembers class * implements java.io.Serializable {
  316. static final long serialVersionUID;
  317. private static final java.io.ObjectStreamField[] serialPersistentFields;
  318. private void writeObject(java.io.ObjectOutputStream);
  319. private void readObject(java.io.ObjectInputStream);
  320. java.lang.Object writeReplace();
  321. java.lang.Object readResolve();
  322. }
  323. -keep public class * implements java.io.Serializable {*;}
  324.  
  325. # support-v4
  326. #https://stackoverflow.com/questions/18978706/obfuscate-android-support-v7-widget-gridlayout-issue
  327. -dontwarn android.support.v4.**
  328. -keep class android.support.v4.app.** { *; }
  329. -keep interface android.support.v4.app.** { *; }
  330. -keep class android.support.v4.** { *; }
  331.  
  332. # support-v7
  333. -dontwarn android.support.v7.**
  334. -keep class android.support.v7.internal.** { *; }
  335. -keep interface android.support.v7.internal.** { *; }
  336. -keep class android.support.v7.** { *; }
  337.  
  338. # support design
  339. #@link http://stackoverflow.com/a/31028536
  340. -dontwarn android.support.design.**
  341. -keep class android.support.design.** { *; }
  342. -keep interface android.support.design.** { *; }
  343. -keep public class android.support.design.R$* { *; }
  344. #-------------------------------------------------------------------------
  345.  
  346. # picasso
  347. -keep class com.squareup.picasso.** {*; }
  348. -dontwarn com.squareup.picasso.**
  349.  
  350. #glide
  351. -keep public class * implements com.bumptech.glide.module.GlideModule
  352. -keep public enum com.bumptech.glide.load.resource.bitmap.ImageHeaderParser$** {
  353. **[] $VALUES;
  354. public *;
  355. }
  356.  
  357. # # ######## greenDao混淆 ##########
  358. # # -------------------------------------------
  359. -keep class de.greenrobot.dao.** {*;}
  360. -keepclassmembers class * extends de.greenrobot.dao.AbstractDao {
  361. public static Java.lang.String TABLENAME;
  362. }
  363. -keep class **$Properties
  364. # # ############### volley混淆 ###############
  365. # # -------------------------------------------
  366. -keep class com.android.volley.** {*;}
  367. -keep class com.android.volley.toolbox.** {*;}
  368. -keep class com.android.volley.Response$* { *; }
  369. -keep class com.android.volley.Request$* { *; }
  370. -keep class com.android.volley.RequestQueue$* { *; }
  371. -keep class com.android.volley.toolbox.HurlStack$* { *; }
  372. -keep class com.android.volley.toolbox.ImageLoader$* { *; }
  373.  
  374. #jpush极光推送
  375. -dontwarn cn.jpush.**
  376. -keep class cn.jpush.** { *; }
  377.  
  378. #activeandroid
  379. -keep class com.activeandroid.** { *; }
  380. -dontwarn com.ikoding.app.biz.dataobject.**
  381. -keep public class com.ikoding.app.biz.dataobject.** { *;}
  382. -keepattributes *Annotation*
  383.  
  384. #log4j
  385. -dontwarn org.apache.log4j.**
  386. -keep class org.apache.log4j.** { *;}
  387. #下面几行 是环信即时通信的代码混淆
  388. -keep class com.easemob.** {*;}
  389. -keep class org.jivesoftware.** {*;}
  390. -dontwarn com.easemob.**
  391.  
  392. #融云
  393. -keepclassmembers class fqcn.of.javascript.interface.for.webview {
  394. public *;
  395. }
  396.  
  397. -keepattributes Exceptions,InnerClasses
  398.  
  399. -keep class io.rong.** {*;}
  400.  
  401. -keep class * implements io.rong.imlib.model.MessageContent{*;}
  402.  
  403. -keepattributes Signature
  404.  
  405. -keepattributes *Annotation*
  406.  
  407. -keep class sun.misc.Unsafe { *; }
  408.  
  409. -keep class com.google.gson.examples.android.model.** { *; }
  410.  
  411. -keepclassmembers class * extends com.sea_monster.dao.AbstractDao {
  412. public static java.lang.String TABLENAME;
  413. }
  414. -keep class **$Properties
  415. -dontwarn org.eclipse.jdt.annotation.**
  416.  
  417. -keep class com.ultrapower.** {*;}
  418. #高徳地图
  419. -dontwarn com.amap.api.**
  420. -dontwarn com.a.a.**
  421. -dontwarn com.autonavi.**
  422. -keep class com.amap.api.** {*;}
  423. -keep class com.autonavi.** {*;}
  424. -keep class com.a.a.** {*;}
  425. #---------------------------------反射相关的类和方法-----------------------
  426. 在这下面写反射相关的类和方法,没有就不用写!
  427.  
  428. #---------------------------------与js互相调用的类------------------------
  429. 在这下面写与js互相调用的类,没有就去掉这句话!
  430.  
  431. #---------------------------------自定义View的类------------------------
  432. 在这下面写自定义View的类的类,没有就去掉这句话!
  433.  
  434. #SuperID
  435. #由*郭宇翔*贡献混淆代码
  436. #作者Github地址:https://github.com/yourtion
  437. -keep class **.R$* {*;}
  438. -keep class com.isnc.facesdk.aty.**{*;}
  439. -keep class com.isnc.facesdk.**{*;}
  440. -keep class com.isnc.facesdk.common.**{*;}
  441. -keep class com.isnc.facesdk.net.**{*;}
  442. -keep class com.isnc.facesdk.view.**{*;}
  443. -keep class com.isnc.facesdk.viewmodel.**{*;}
  444. -keep class com.matrixcv.androidapi.face.**{*;}
  445.  
  446. #retrofit2.x
  447. -dontwarn retrofit2.**
  448. -keep class retrofit2.** { *; }
  449. -keepattributes Signature
  450. -keepattributes Exceptions
  451.  
  452. #Rxjava RxAndroid
  453. -dontwarn rx.*
  454. -dontwarn sun.misc.**
  455.  
  456. -keepclassmembers class rx.internal.util.unsafe.*ArrayQueue*Field* {
  457. long producerIndex;
  458. long consumerIndex;
  459. }
  460.  
  461. -keepclassmembers class rx.internal.util.unsafe.BaseLinkedQueueProducerNodeRef {
  462. rx.internal.util.atomic.LinkedQueueNode producerNode;
  463. }
  464.  
  465. -keepclassmembers class rx.internal.util.unsafe.BaseLinkedQueueConsumerNodeRef {
  466. rx.internal.util.atomic.LinkedQueueNode consumerNode;
  467. }
  468.  
  469. #litepal
  470. -dontwarn org.litepal.
  471. -keep class org.litepal.* { ; }
  472. -keep enum org.litepal.*
  473. -keep interface org.litepal. { ; }
  474. -keep public class extends org.litepal.
  475. -keepattributes Annotation
  476. -keepclassmembers class extends org.litepal.crud.DataSupport{;}
  477.  
  478. #fastJson
  479. -dontwarn com.alibaba.fastjson.**
  480. -keep class com.alibaba.fastjson.** { *; }

Android 混淆总结(直接copy)(转)的更多相关文章

  1. android混淆那些事

    写给Android开发者的混淆使用手册 综述 毫无疑问,混淆是打包过程中最重要的流程之一,在没有特殊原因的情况下,所有 app 都应该开启混淆. 首先,这里说的的混淆其实是包括了代码压缩.代码混淆以及 ...

  2. Android混淆打包配置总结

    Android打包失败出现Proguard returned with error code 1. See console的错误 这个问题是由于代码混淆引起的,找不到引用包. 只需在你的proguar ...

  3. Android混淆那些事儿

    博客: 安卓之家 微博: 追风917 CSDN: 蒋朋的家 简书: 追风917 博客园:追风917 # Android混淆 Android混淆是Android开发者经常使用的一种用于代码防止被反编译的 ...

  4. Android混淆、反编译以及反破解的简单回顾

    =========================================================================虽然反编译很简单,也没下面说的那么复杂,不过还是转了过 ...

  5. Android 混淆那些事儿

    本文来自于腾讯Bugly公众号(weixinBugly),未经作者同意,请勿转载,原文地址:https://mp.weixin.qq.com/s/WmJyiA3fDNriw5qXuoA9MA 作者:l ...

  6. android -------- 混淆打包报错(warning - InnerClass annotations are missing corresponding EnclosingMember annotations)

    最近做Android混淆打包遇到一些问题,Android Sdutio 3.1 版本打包的 错误如下: Android studio warning - InnerClass annotations ...

  7. Android 混淆代码有关问题总结

    Android 混淆代码问题总结 Android 混淆代码: 最快的方式: 1. 首先更新Android的SDK至最新版本,重新建立1个工程,把源码和资源及其他文件拷到新的工程里面. 2. 工程目录底 ...

  8. Android 混淆[学习笔记]

    Android 混淆 Gradle的简介: http://www.flysnow.org/2015/03/30/manage-your-android-project-with-gradle.html ...

  9. 5分钟搞定android混淆(转)

    转自:https://www.jianshu.com/p/f3455ecaa56e 前言 混淆是上线前挺重要的一个环节.android使用的ProGuard,可以起到压缩,混淆,预检,优化的作用.但是 ...

随机推荐

  1. mongodb 稀疏索引

    稀疏索引(或者称间隙索引)就是只包含有索引字段的文档的条目,即使索引字段包含一个空值.也就是说间隙索引可以跳过那些索引键不存在的文档.因为他并非包含所有的文档,因此称为稀疏索引.与之相对的非稀疏索引或 ...

  2. java Map的四种遍历方式

    1.这是最常见的并且在大多数情况下也是最可取的遍历方式,在键值都需要时使用. Map<Integer, Integer> map = new HashMap<Integer, Int ...

  3. STM32F103系列命名规则

    对于STM32F103xxyy系列:第一个x代表引脚数:T-36pin,C-48pin,R-64pin,V-100pin,Z-144pin:第二个x代表Flash容量:6-32K,8-64K,B-12 ...

  4. PHP 利用 curl 发送 post get del put patch 请求

    因为需要在 php 开发中对接其它接口需要用 php curl 去对接其它接口 我把他们封装成函数 希望能对大家有所帮助. 这里面是封装好的会自动把 data 进行转成 json 格式,同时解码成 p ...

  5. vue打包配置发布路径

    目的:配置路径,让打包后的dist在本地可以打开. 方法:修改build文件夹下边的的webpack.dev.conf.js文件,找到devServer下边的publicPath,这个来源于confi ...

  6. (转)VirtualBox下安装CentOS7系统

    转:https://www.cnblogs.com/hihtml5/p/8217062.html 本文假定你已经知道如何安装VirtualBox虚拟机软件,并且已经安装好了. 首先我们需要准备好cen ...

  7. (转)df命令

    转:http://man.linuxde.net/df df命令用于显示磁盘分区上的可使用的磁盘空间.默认显示单位为KB.可以利用该命令来获取硬盘被占用了多少空间,目前还剩下多少空间等信息. 语法 d ...

  8. php面试专题---4、流程控制考点

    php面试专题---4.流程控制考点 一.总结 一句话总结: 理解循环内部机制(指针操作),更易于记忆foreach的reset特性,分支结构中理解了switch...case的执行步骤(跳转表)也就 ...

  9. 【转】 Linux 的目录详解 (Linux基础一)

    前言 转自: http://c.biancheng.net/view/2833.html 进行了一些提炼和修改. 学习 Linux,不仅限于学习各种命令,了解整个 Linux 文件系统的目录结构以及各 ...

  10. JDK 与 JRE

    JDK就是Java Development Kit.简单的说JDK是面向开发人员使用的SDK,它提供了Java的开发环境和运行环境.SDK是Software Development Kit 一般指软件 ...