proguard-rules.pro 13 KB

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