proguard-rules.pro 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405
  1. # Add project specific ProGuard rules here.
  2. # By default, the flags in this file are appended to flags specified
  3. # in D:\work\software\SDK/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. # Add any project specific keep options here:
  10. # If your project uses WebView with JS, uncomment the following
  11. # and specify the fully qualified class name to the JavaScript interface
  12. # class:
  13. -keepclassmembers class fqcn.of.javascript.interface.for.webview {
  14. public *;
  15. }
  16. # Uncomment this to preserve the line number information for
  17. # debugging stack traces.
  18. #-keepattributes SourceFile,LineNumberTable
  19. # If you keep the line number information, uncomment this to
  20. # hide the original source file name.
  21. #-renamesourcefileattribute SourceFile
  22. -dontwarn okhttp3.**
  23. -dontwarn okio.**
  24. -dontwarn javax.annotation.**
  25. # A resource is loaded with a relative path so the package of this class must be preserved.
  26. -keepnames class okhttp3.internal.publicsuffix.PublicSuffixDatabase
  27. -keep class com.tencent.mm.opensdk.** { *;}
  28. -keep class com.tencent.wxop.** { *;}
  29. -keep class com.tencent.mm.sdk.** { *;}
  30. -dontwarn com.tencent.bugly.**
  31. -keep public class com.tencent.bugly.**{*;}
  32. -keep class android.support.**{*;}
  33. #友盟
  34. -keep class com.umeng.** {*;}
  35. #指定代码的压缩级别
  36. -optimizationpasses 5
  37. #不去忽略非公共的库类
  38. -dontskipnonpubliclibraryclasses
  39. -dontskipnonpubliclibraryclassmembers
  40. # 是否使用大小写混合
  41. -dontusemixedcaseclassnames
  42. #预校验
  43. -dontpreverify
  44. #混淆时是否记录日志
  45. -verbose
  46. #忽略警告,避免打包时某些警告出现
  47. -ignorewarning
  48. # 混淆时所采用的算法
  49. -optimizations !code/simplification/arithmetic,!field/*,!class/merging/*
  50. #保护注解
  51. -keepattributes *Annotation*
  52. #记录生成的日志数据,gradle build时在本项目根目录输出
  53. #apk 包内所有 class 的内部结构
  54. -dump class_files.txt
  55. #未混淆的类和成员
  56. -printseeds seeds.txt
  57. #列出从 apk 中删除的代码
  58. -printusage unused.txt
  59. #混淆前后的映射
  60. -printmapping mapping.txt
  61. # 保持哪些类不被混淆
  62. -keep public class * extends android.app.Activity
  63. -keep public class * extends android.app.Fragment
  64. -keep public class * extends android.app.Application
  65. -keep public class * extends android.app.Service
  66. -keep public class * extends android.content.BroadcastReceiver
  67. -keep public class * extends android.content.ContentProvider
  68. -keep public class * extends android.app.backup.BackupAgentHelper
  69. -keep public class * extends android.preference.Preference
  70. -keep public class com.android.vending.licensing.ILicensingService
  71. -keep class * implements java.io.Serializable
  72. -keepattributes *Annotation*
  73. -keepclassmembers class ** {
  74. @org.greenrobot.eventbus.Subscribe <methods>;
  75. }
  76. -keep enum org.greenrobot.eventbus.ThreadMode { *; }
  77. # Only required if you use AsyncExecutor
  78. -keepclassmembers class * extends org.greenrobot.eventbus.util.ThrowableFailureEvent {
  79. <init>(java.lang.Throwable);
  80. }
  81. #app
  82. #忽略bean类
  83. -keep class com.googlecode.protobuf.format.** { *; }
  84. -keep class com.kfzs.duanduan.bean.** { *; }
  85. -keep class com.kfzs.duanduan.proto.** { *; }
  86. -keep class com.sheep.gamegroup.model.** { *; }
  87. -keep class com.sheep.jiuyan.samllsheep.service.DownloadService { *; }
  88. #datashare
  89. -keep class com.kfzs.duanduan.data.graph.** { *; }
  90. -keep class com.kfzs.duanduan.datashare.** { *; }
  91. #ari
  92. #-keep class com.arialyy.** { *; }
  93. -dontwarn com.arialyy.aria.**
  94. -keep class com.arialyy.aria.**{*;}
  95. -keep class **$$DownloadListenerProxy{ *; }
  96. -keep class **$$UploadListenerProxy{ *; }
  97. -keep class **$$DownloadGroupListenerProxy{ *; }
  98. -keepclasseswithmembernames class * {
  99. @Download.* <methods>;
  100. @Upload.* <methods>;
  101. @DownloadGroup.* <methods>;
  102. }
  103. -keep class org.** { *; }
  104. -keep class sun.** { *; }
  105. -keep class net.** { *; }
  106. -keep class com.fasterxml.** { *; }
  107. -keep class javax.** { *; }
  108. -keep class rx.** { *; }
  109. # Retrofit 2.X
  110. ## https://square.github.io/retrofit/ ##
  111. -dontwarn retrofit2.**
  112. -keep class retrofit2.** { *; }
  113. -keepattributes Signature
  114. -keepattributes Exceptions
  115. -keepclasseswithmembers class * {
  116. @retrofit2.http.* <methods>;
  117. }
  118. # Retrofit 1.X
  119. -keep class com.squareup.okhttp.** { *; }
  120. -keep class retrofit.** { *; }
  121. -keep interface com.squareup.okhttp.** { *; }
  122. -dontwarn com.squareup.okhttp.**
  123. -dontwarn okio.**
  124. -dontwarn retrofit.**
  125. -dontwarn rx.**
  126. -keepclasseswithmembers class * {
  127. @retrofit.http.* <methods>;
  128. }
  129. # If in your rest service interface you use methods with Callback argument.
  130. -keepattributes Exceptions
  131. # If your rest service methods throw custom exceptions, because you've defined an ErrorHandler.
  132. -keepattributes Signature
  133. # Also you must note that if you are using GSON for conversion from JSON to POJO representation, you must ignore those POJO classes from being obfuscated.
  134. # Here include the POJO's that have you have created for mapping JSON response to POJO for example.
  135. ## Square Otto specific rules ##
  136. ## https://square.github.io/otto/ ##
  137. -keepattributes *Annotation*
  138. -keepclassmembers class ** {
  139. @com.squareup.otto.Subscribe public *;
  140. @com.squareup.otto.Produce public *;
  141. }
  142. ## Square Picasso specific rules ##
  143. ## https://square.github.io/picasso/ ##
  144. -dontwarn com.squareup.okhttp.**
  145. # OkHttp
  146. -keepattributes Signature
  147. -keepattributes *Annotation*
  148. -keep class okhttp3.** { *; }
  149. -keep interface okhttp3.** { *; }
  150. -dontwarn okhttp3.**
  151. # Dagger ProGuard rules.
  152. # https://github.com/square/dagger
  153. -dontwarn dagger.internal.codegen.**
  154. -keepclassmembers,allowobfuscation class * {
  155. @javax.inject.* *;
  156. @dagger.* *;
  157. <init>();
  158. }
  159. -keep class dagger.* { *; }
  160. -keep class javax.inject.* { *; }
  161. -keep class * extends dagger.internal.Binding
  162. -keep class * extends dagger.internal.ModuleAdapter
  163. -keep class * extends dagger.internal.StaticInjection
  164. # RxJava 0.21
  165. -keep class rx.schedulers.Schedulers {
  166. public static <methods>;
  167. }
  168. -keep class rx.schedulers.ImmediateScheduler {
  169. public <methods>;
  170. }
  171. -keep class rx.schedulers.TestScheduler {
  172. public <methods>;
  173. }
  174. -keep class rx.schedulers.Schedulers {
  175. public static ** test();
  176. }
  177. # Configuration for Guava 18.0
  178. #
  179. # disagrees with instructions provided by Guava project: https://code.google.com/p/guava-libraries/wiki/UsingProGuardWithGuava
  180. -keep class com.google.common.io.Resources {
  181. public static <methods>;
  182. }
  183. -keep class com.google.common.collect.Lists {
  184. public static ** reverse(**);
  185. }
  186. -keep class com.google.common.base.Charsets {
  187. public static <fields>;
  188. }
  189. -keep class com.google.common.base.Joiner {
  190. public static com.google.common.base.Joiner on(java.lang.String);
  191. public ** join(...);
  192. }
  193. -keep class com.google.common.collect.MapMakerInternalMap$ReferenceEntry
  194. -keep class com.google.common.cache.LocalCache$ReferenceEntry
  195. # http://stackoverflow.com/questions/9120338/proguard-configuration-for-guava-with-obfuscation-and-optimization
  196. -dontwarn javax.annotation.**
  197. -dontwarn javax.inject.**
  198. -dontwarn sun.misc.Unsafe
  199. # Guava 19.0
  200. -dontwarn java.lang.ClassValue
  201. -dontwarn com.google.j2objc.annotations.Weak
  202. -dontwarn org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement
  203. ## GSON 2.2.4 specific rules ##
  204. # Gson uses generic type information stored in a class file when working with fields. Proguard
  205. # removes such information by default, so configure it to keep all of it.
  206. -keepattributes Signature
  207. # For using GSON @Expose annotation
  208. -keepattributes *Annotation*
  209. -keepattributes EnclosingMethod
  210. # Gson specific classes
  211. -keep class sun.misc.Unsafe { *; }
  212. -keep class com.google.gson.stream.** { *; }
  213. # GreenDao rules
  214. # Source: http://greendao-orm.com/documentation/technical-faq
  215. #
  216. -keepclassmembers class * extends de.greenrobot.dao.AbstractDao {
  217. public static java.lang.String TABLENAME;
  218. }
  219. -keep class **$Properties
  220. # Glide specific rules #
  221. # https://github.com/bumptech/glide
  222. -keep public class * implements com.bumptech.glide.module.GlideModule
  223. -keep public enum com.bumptech.glide.load.resource.bitmap.ImageHeaderParser$** {
  224. **[] $VALUES;
  225. public *;
  226. }
  227. # Fresco v0.8.1 ProGuard rules.
  228. # https://github.com/facebook/fresco
  229. -keep,allowobfuscation @interface com.facebook.common.internal.DoNotStrip
  230. # Do not strip any method/class that is annotated with @DoNotStrip
  231. -keep @com.facebook.common.internal.DoNotStrip class *
  232. -keepclassmembers class * {
  233. @com.facebook.common.internal.DoNotStrip *;
  234. }
  235. # Keep native methods
  236. -keepclassmembers class * {
  237. native <methods>;
  238. }
  239. -dontwarn okio.**
  240. -dontwarn javax.annotation.**
  241. -dontwarn com.android.volley.toolbox.**
  242. ## New rules for EventBus 3.0.x ##
  243. # http://greenrobot.org/eventbus/documentation/proguard/
  244. -keepattributes *Annotation*
  245. -keepclassmembers class ** {
  246. @org.greenrobot.eventbus.Subscribe <methods>;
  247. }
  248. -keep enum org.greenrobot.eventbus.ThreadMode { *; }
  249. # Only required if you use AsyncExecutor
  250. -keepclassmembers class * extends org.greenrobot.eventbus.util.ThrowableFailureEvent {
  251. <init>(java.lang.Throwable);
  252. }
  253. #Easy-Adapter v1.5.0
  254. -keepattributes *Annotation*
  255. -keepclassmembers class * extends uk.co.ribot.easyadapter.ItemViewHolder {
  256. public <init>(...);
  257. }
  258. # Crashlytics 2.+
  259. -keep class com.crashlytics.** { *; }
  260. -keep class com.crashlytics.android.**
  261. -keepattributes SourceFile, LineNumberTable, *Annotation*
  262. # If you are using custom exceptions, add this line so that custom exception types are skipped during obfuscation:
  263. -keep public class * extends java.lang.Exception
  264. # For Fabric to properly de-
  265. # ButterKnife 7
  266. -keep class butterknife.** { *; }
  267. -dontwarn butterknife.internal.**
  268. -keep class **$$ViewBinder { *; }
  269. -keepclasseswithmembernames class * {
  270. @butterknife.* <fields>;
  271. }
  272. -keepclasseswithmembernames class * {
  273. @butterknife.* <methods>;
  274. }
  275. # fastjson proguard rules
  276. # https://github.com/alibaba/fastjson
  277. -dontwarn com.alibaba.fastjson.**
  278. -keepattributes Signature
  279. -keepattributes *Annotation*
  280. ## ActionBarSherlock 4.4.0 specific rules ##
  281. -keep class android.support.v4.app.** { *; }
  282. -keep interface android.support.v4.app.** { *; }
  283. -keep class com.actionbarsherlock.** { *; }
  284. -keep interface com.actionbarsherlock.** { *; }
  285. -keepattributes *Annotation*
  286. ## hack for Actionbarsherlock 4.4.0, see https://github.com/JakeWharton/ActionBarSherlock/issues/1001 ##
  287. -dontwarn com.actionbarsherlock.internal.**
  288. ## SVG Android ##
  289. #https://github.com/pents90/svg-android
  290. -keep class com.larvalabs.svgandroid.** {*;}
  291. -keep class com.larvalabs.svgandroid.*$* {*;}
  292. -keep public class android.support.v7.widget.** { *; }
  293. -keep public class android.support.v7.internal.widget.** { *; }
  294. -keep public class android.support.v7.internal.view.menu.** { *; }
  295. -keep public class * extends android.support.v4.view.ActionProvider {
  296. public <init>(android.content.Context);
  297. }
  298. -dontwarn android.support.design.**
  299. -keep class android.support.design.** { *; }
  300. -keep interface android.support.design.** { *; }
  301. -keep public class android.support.design.R$* { *; }
  302. ##极光推送
  303. -dontoptimize
  304. -dontpreverify
  305. -dontwarn cn.jpush.**
  306. -keep class cn.jpush.** { *; }
  307. -keep class * extends cn.jpush.android.helpers.JPushMessageReceiver { *; }
  308. -dontwarn cn.jiguang.**
  309. -keep class cn.jiguang.** { *; }
  310. #2.0.5 ~ 2.1.7 版本有引入 gson 和 protobuf ,增加排除混淆的配置。(2.1.8版本不需配置)
  311. #==================gson && protobuf==========================
  312. -dontwarn com.google.**
  313. -keep class com.google.gson.** {*;}
  314. -keep class com.google.protobuf.** {*;}