proguard-rules.pro 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389
  1. # Add project specific ProGuard rules here.
  2. # You can control the set of applied configuration files using the
  3. # proguardFiles setting in build.gradle.
  4. #
  5. # For more details, see
  6. # http://developer.android.com/guide/developing/tools/proguard.html
  7. # If your project uses WebView with JS, uncomment the following
  8. # and specify the fully qualified class name to the JavaScript interface
  9. # class:
  10. #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
  11. # public *;
  12. #}
  13. # Uncomment this to preserve the line number information for
  14. # debugging stack traces.
  15. #-keepattributes SourceFile,LineNumberTable
  16. # If you keep the line number information, uncomment this to
  17. # hide the original source file name.
  18. #-renamesourcefileattribute SourceFile
  19. #指定压缩级别
  20. -optimizationpasses 5
  21. #不跳过非公共的库的类成员
  22. -dontskipnonpubliclibraryclassmembers
  23. #混淆时采用的算法
  24. -optimizations !code/simplification/arithmetic,!field/*,!class/merging/*
  25. #把混淆类中的方法名也混淆了
  26. -useuniqueclassmembernames
  27. # 屏蔽警告
  28. -ignorewarnings
  29. #优化时允许访问并修改有修饰符的类和类的成员
  30. -allowaccessmodification
  31. #将文件来源重命名为“SourceFile”字符串
  32. -renamesourcefileattribute SourceFile
  33. #保留行号
  34. -keepattributes SourceFile,LineNumberTable
  35. #保持所有实现 Serializable 接口的类成员
  36. -keepclassmembers class * implements java.io.Serializable {
  37. static final long serialVersionUID;
  38. private static final java.io.ObjectStreamField[] serialPersistentFields;
  39. private void writeObject(java.io.ObjectOutputStream);
  40. private void readObject(java.io.ObjectInputStream);
  41. java.lang.Object writeReplace();
  42. java.lang.Object readResolve();
  43. }
  44. #避免混淆Annotation、内部类、泛型、匿名类
  45. -keepattributes InnerClasses,Signature,EnclosingMethod
  46. #处理support包
  47. -dontnote android.support.**
  48. -dontwarn android.support.**
  49. #保留四大组件,自定义的Application等这些类不被混淆
  50. -keep public class * extends android.app.Activity
  51. -keep public class * extends android.app.Application
  52. -keep public class * extends android.app.Service
  53. -keep public class * extends android.content.BroadcastReceiver
  54. -keep public class * extends android.content.ContentProvider
  55. -keep public class * extends android.preference.Preference
  56. -keep public class com.android.vending.licensing.ILicensingService
  57. #保留枚举类不被混淆
  58. -keep class * implements android.os.Parcelable {
  59. public static final android.os.Parcelable$Creator *;
  60. }
  61. #Fragment不需要在AndroidManifest.xml中注册,需要额外保护下
  62. -keep public class * extends android.support.v4.app.Fragment
  63. -keep public class * extends android.app.Fragment
  64. -keep public class * extends androidx.fragment.app.Fragment
  65. -keepclasseswithmembernames class * {
  66. native <methods>;
  67. }
  68. -printmapping mapping.txt #混淆后文件映射
  69. -keepclasseswithmembers class * {
  70. public <init>(android.content.Context);
  71. }
  72. -keepclasseswithmembers class * {
  73. public <init>(android.content.Context, android.util.AttributeSet);
  74. }
  75. -keepclasseswithmembers class * {
  76. public <init>(android.content.Context, android.util.AttributeSet, int);
  77. }
  78. -keepclassmembers enum * {
  79. public static **[] values();
  80. public static ** valueOf(java.lang.String);
  81. }
  82. #webView需要进行特殊处理
  83. -keepclassmembers class fqcn.of.javascript.interface.for.Webview {
  84. public *;
  85. }
  86. -keepclassmembers class * extends android.webkit.WebViewClient {
  87. public void *(android.webkit.WebView, java.lang.String, android.graphics.Bitmap);
  88. public boolean *(android.webkit.WebView, java.lang.String);
  89. }
  90. -keepclassmembers class * extends android.webkit.WebViewClient {
  91. public void *(android.webkit.WebView, jav.lang.String);
  92. }
  93. #表示不混淆任何一个View中的setXxx()和getXxx()方法,
  94. #因为属性动画需要有相应的setter和getter的方法实现,混淆了就无法工作了。
  95. -keep public class * extends android.view.View{
  96. *** get*();
  97. void set*(***);
  98. public <init>(android.content.Context);
  99. public <init>(android.content.Context, android.util.AttributeSet);
  100. public <init>(android.content.Context, android.util.AttributeSet, int);
  101. }
  102. -keepclasseswithmembers class * {
  103. public <init>(android.content.Context, android.util.AttributeSet);
  104. public <init>(android.content.Context, android.util.AttributeSet, int);
  105. }
  106. -keep class * extends java.lang.annotation.Annotation {*;}
  107. ##Gson
  108. -dontwarn com.google.**
  109. -keep class com.google.gson.** {*;}
  110. #otto
  111. -keepattributes *Annotation*
  112. -keepclassmembers class ** {
  113. @com.squareup.Subscribe public *;
  114. @com.squareup.otto.Produce public *;
  115. }
  116. #xlib
  117. -dontwarn x.lib.**
  118. -keep class x.lib.**{*;}
  119. #entity
  120. -keep class com.starbuds.app.entity.**{*;}
  121. #-keep class com.starbuds.app.entity.db.**{*;}
  122. -dontwarn com.starbuds.app.widget.**
  123. -keep class com.starbuds.app.widget.**{*;}
  124. #友盟
  125. -keep class com.umeng.** {*;}
  126. -keep class com.uc.** {*;}
  127. -keepclassmembers class * {
  128. public <init> (org.json.JSONObject);
  129. }
  130. -keepclassmembers enum * {
  131. public static **[] values();
  132. public static ** valueOf(java.lang.String);
  133. }
  134. -keep class com.zui.** {*;}
  135. -keep class com.miui.** {*;}
  136. -keep class com.heytap.** {*;}
  137. -keep class a.** {*;}
  138. -keep class com.vivo.** {*;}
  139. -keep public class com.starbuds.app.R$*{
  140. public static final int *;
  141. }
  142. #字节美颜
  143. -keep class com.bytedance.labcv.effectsdk.**{*;}
  144. #okhttp
  145. -dontwarn com.squareup.okhttp.**
  146. -keep class com.squareup.okhttp.** {*;}
  147. -keep interface com.squareup.okhttp.** {*;}
  148. -dontwarn okio.**
  149. #Glide
  150. -dontwarn com.bumptech.glide.**
  151. -keep class com.bumptech.glide.**{*;}
  152. -keep public class * implements com.bumptech.glide.module.GlideModule
  153. -keep public class * extends com.bumptech.glide.AppGlideModule
  154. -keep public enum com.bumptech.glide.load.resource.bitmap.ImageHeaderParser$** {
  155. **[] $VALUES;
  156. public *;
  157. }
  158. #SVGA
  159. -keep class com.squareup.wire.** { *; }
  160. -keep class com.opensource.svgaplayer.proto.** { *; }
  161. #声网
  162. -keep class io.agora.**{*;}
  163. #闪验
  164. -dontwarn com.cmic.sso.sdk.**
  165. -dontwarn com.sdk.**
  166. -keep class com.cmic.sso.sdk.**{*;}
  167. -keep class com.sdk.** { *;}
  168. -keep class cn.com.chinatelecom.account.api.**{*;}
  169. # 七牛视频混淆
  170. -keep class com.pili.pldroid.player.** { *; }
  171. -keep class com.qiniu.qplayer.mediaEngine.MediaPlayer{*;}
  172. -keep class com.qiniu.pili.droid.**{*;}
  173. -keep class com.qiniu.pili.droid.streaming.** { *; }
  174. # 七牛RTC混淆
  175. -keep class com.youme.** {*;}
  176. -keep class org.webrtc.** {*;}
  177. -keep class com.qiniu.android.dns.** {*;}
  178. -keep class com.qiniu.pili.droid.streaming.** {*;}
  179. -keep class com.sensetime.**{*;}
  180. # 七牛RTC混淆
  181. -keep class org.webrtc.** {*;}
  182. -dontwarn org.webrtc.**
  183. -keep class com.qiniu.droid.rtc.**{*;}
  184. -keep interface com.qiniu.droid.rtc.**{*;}
  185. # 阿里云推送混淆
  186. -keepclasseswithmembernames class ** {
  187. native <methods>;
  188. }
  189. -keep class sun.misc.Unsafe { *; }
  190. -keep class com.taobao.** {*;}
  191. -keep class com.alibaba.** {*;}
  192. -keep class com.alipay.** {*;}
  193. -keep class com.ut.** {*;}
  194. -keep class com.ta.** {*;}
  195. -keep class anet.**{*;}
  196. -keep class anetwork.**{*;}
  197. -keep class org.android.spdy.**{*;}
  198. -keep class org.android.agoo.**{*;}
  199. -keep class android.os.**{*;}
  200. -dontwarn com.taobao.**
  201. -dontwarn com.alibaba.**
  202. -dontwarn com.alipay.**
  203. -dontwarn anet.**
  204. -dontwarn org.android.spdy.**
  205. -dontwarn org.android.agoo.**
  206. -dontwarn anetwork.**
  207. -dontwarn com.ut.**
  208. -dontwarn com.ta.**
  209. -dontwarn com.aliyuncs.**
  210. -keep class com.aliyuncs.**{*;}
  211. # 阿里云RTC
  212. -keep class com.serenegiant.**{*;}
  213. -keep class org.webrtc.**{*;}
  214. -keep class com.alivc.**{*;}
  215. # UCrop
  216. -dontwarn com.yalantis.ucrop**
  217. -keep class com.yalantis.ucrop** { *; }
  218. -keep interface com.yalantis.ucrop** { *; }
  219. # 华为
  220. -ignorewarning
  221. -keepattributes *Annotation*
  222. -keepattributes Exceptions
  223. -keepattributes InnerClasses
  224. -keepattributes Signature
  225. -keepattributes SourceFile,LineNumberTable
  226. -keep class com.hianalytics.android.**{*;}
  227. -keep class com.huawei.updatesdk.**{*;}
  228. -keep class com.huawei.hms.**{*;}
  229. -keep class com.huawei.android.hms.agent.**{*;}
  230. -keep class com.huawei.gamebox.plugin.gameservice.**{*;}
  231. # 定位
  232. -keep class com.amap.api.location.**{*;}
  233. -keep class com.amap.api.fence.**{*;}
  234. -keep class com.loc.**{*;}
  235. -keep class com.autonavi.aps.amapapi.model.**{*;}
  236. # jzvd
  237. -keep public class cn.jzvd.JZMediaSystem {*; }
  238. -keep public class cn.jzvd.demo.CustomMedia.CustomMedia {*; }
  239. -keep public class cn.jzvd.demo.CustomMedia.JZMediaIjk {*; }
  240. -keep public class cn.jzvd.demo.CustomMedia.JZMediaSystemAssertFolder {*; }
  241. -keep class tv.danmaku.ijk.media.player.** {*; }
  242. -dontwarn tv.danmaku.ijk.media.player.*
  243. -keep interface tv.danmaku.ijk.media.player.** { *; }
  244. # 腾讯IM
  245. -keep class com.tencent.** { *; }
  246. # 微信
  247. -keep class com.tencent.mm.opensdk.** {*;}
  248. -keep class com.tencent.wxop.** {*;}
  249. -keep class com.tencent.mm.sdk.** {*;}
  250. # QQ
  251. -keep class com.tencent.imsdk.** {*;}
  252. # 微博
  253. -keep class com.sina.weibo.sdk.** { *; }
  254. # Bugly
  255. -dontwarn com.tencent.bugly.**
  256. -keep public class com.tencent.bugly.**{*;}
  257. -keep class org.greenrobot.greendao.**{*;}
  258. -keepclassmembers class * extends org.greenrobot.greendao.AbstractDao {
  259. public static java.lang.String TABLENAME;
  260. }
  261. -keep class **$Properties
  262. -keep class net.sqlcipher.database.**{*;}
  263. -keep public interface net.sqlcipher.database.**
  264. -dontwarn net.sqlcipher.database.**
  265. -dontwarn org.greenrobot.greendao.**
  266. -keepclassmembers class ** {
  267. @org.greenrobot.eventbus.Subscribe <methods>;
  268. }
  269. -keep enum org.greenrobot.eventbus.ThreadMode { *; }
  270. # Only required if you use AsyncExecutor
  271. -keepclassmembers class * extends org.greenrobot.eventbus.util.ThrowableFailureEvent {
  272. <init>(java.lang.Throwable);
  273. }
  274. # ali
  275. -keepclasseswithmembernames class ** {
  276. native <methods>;
  277. }
  278. -keepattributes Signature
  279. -keep class sun.misc.Unsafe { *; }
  280. -keep class com.taobao.** {*;}
  281. -keep class com.alibaba.** {*;}
  282. -keep class com.alipay.** {*;}
  283. -keep class com.ut.** {*;}
  284. -keep class com.ta.** {*;}
  285. -keep class anet.**{*;}
  286. -keep class anetwork.**{*;}
  287. -keep class org.android.spdy.**{*;}
  288. -keep class org.android.agoo.**{*;}
  289. -keep class android.os.**{*;}
  290. -keep class org.json.**{*;}
  291. -dontwarn com.taobao.**
  292. -dontwarn com.alibaba.**
  293. -dontwarn com.alipay.**
  294. -dontwarn anet.**
  295. -dontwarn org.android.spdy.**
  296. -dontwarn org.android.agoo.**
  297. -dontwarn anetwork.**
  298. -dontwarn com.ut.**
  299. -dontwarn com.ta.**
  300. # 小米通道
  301. -keep class com.xiaomi.** {*;}
  302. -dontwarn com.xiaomi.**
  303. # 华为通道
  304. -keep class com.huawei.** {*;}
  305. -dontwarn com.huawei.**
  306. # GCM/FCM通道
  307. -keep class com.google.firebase.**{*;}
  308. -dontwarn com.google.firebase.**
  309. # OPPO通道
  310. -keep public class * extends android.app.Service
  311. # VIVO通道
  312. -keep class com.vivo.** {*;}
  313. -dontwarn com.vivo.**
  314. # 魅族通道
  315. -keep class com.meizu.cloud.** {*;}
  316. -dontwarn com.meizu.cloud.**
  317. #Rxjava RxAndroid
  318. -dontwarn rx.*
  319. -dontwarn sun.misc.**
  320. -keep class rx.internal.**{*;}
  321. #ImmersionBar
  322. -keep class com.gyf.immersionbar.* {*;}
  323. -dontwarn com.gyf.immersionbar.**
  324. #security
  325. -keep class com.laylib.security.lib.* {*;}
  326. -dontwarn com.laylib.security.lib.**
  327. # 保持调用jni的类不被混淆
  328. -keep class android_serialport_api.*{*;}
  329. # 设置所有 native 方法不被混淆
  330. -keepclasseswithmembernames class * {
  331. native <methods>;
  332. }