proguard-rules.pro 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419
  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. -keep public class * implements android.os.Parcelable{*;}
  45. -keepclasseswithmembers class * implements android.os.Parcelable {*;}
  46. #避免混淆Annotation、内部类、泛型、匿名类
  47. -keepattributes InnerClasses,Signature,EnclosingMethod
  48. #处理support包
  49. -dontnote android.support.**
  50. -dontwarn android.support.**
  51. #保留四大组件,自定义的Application等这些类不被混淆
  52. -keep public class * extends android.app.Activity
  53. -keep public class * extends android.app.Application
  54. -keep public class * extends android.app.Service
  55. -keep public class * extends android.content.BroadcastReceiver
  56. -keep public class * extends android.content.ContentProvider
  57. -keep public class * extends android.preference.Preference
  58. -keep public class com.android.vending.licensing.ILicensingService
  59. #保留枚举类不被混淆
  60. -keep class * implements android.os.Parcelable {
  61. public static final android.os.Parcelable$Creator *;
  62. }
  63. #Fragment不需要在AndroidManifest.xml中注册,需要额外保护下
  64. -keep public class * extends android.support.v4.app.Fragment
  65. -keep public class * extends android.app.Fragment
  66. -keep public class * extends androidx.fragment.app.Fragment
  67. -keepclasseswithmembernames class * {
  68. native <methods>;
  69. }
  70. -printmapping mapping.txt #混淆后文件映射
  71. -keepclasseswithmembers class * {
  72. public <init>(android.content.Context);
  73. }
  74. -keepclasseswithmembers class * {
  75. public <init>(android.content.Context, android.util.AttributeSet);
  76. }
  77. -keepclasseswithmembers class * {
  78. public <init>(android.content.Context, android.util.AttributeSet, int);
  79. }
  80. -keepclassmembers enum * {
  81. public static **[] values();
  82. public static ** valueOf(java.lang.String);
  83. }
  84. #webView需要进行特殊处理
  85. -keepclassmembers class fqcn.of.javascript.interface.for.Webview {
  86. public *;
  87. }
  88. -keepclassmembers class * extends android.webkit.WebViewClient {
  89. public void *(android.webkit.WebView, java.lang.String, android.graphics.Bitmap);
  90. public boolean *(android.webkit.WebView, java.lang.String);
  91. }
  92. -keepclassmembers class * extends android.webkit.WebViewClient {
  93. public void *(android.webkit.WebView, jav.lang.String);
  94. }
  95. #表示不混淆任何一个View中的setXxx()和getXxx()方法,
  96. #因为属性动画需要有相应的setter和getter的方法实现,混淆了就无法工作了。
  97. -keep public class * extends android.view.View{
  98. *** get*();
  99. void set*(***);
  100. public <init>(android.content.Context);
  101. public <init>(android.content.Context, android.util.AttributeSet);
  102. public <init>(android.content.Context, android.util.AttributeSet, int);
  103. }
  104. -keepclasseswithmembers class * {
  105. public <init>(android.content.Context, android.util.AttributeSet);
  106. public <init>(android.content.Context, android.util.AttributeSet, int);
  107. }
  108. -keep class * extends java.lang.annotation.Annotation {*;}
  109. ##Gson
  110. -dontwarn com.google.**
  111. -keep class com.google.gson.** {*;}
  112. #otto
  113. -keepattributes *Annotation*
  114. -keepclassmembers class ** {
  115. @com.squareup.Subscribe public *;
  116. @com.squareup.otto.Produce public *;
  117. }
  118. #xlib
  119. -dontwarn x.lib.**
  120. -keep class x.lib.**{*;}
  121. #entity
  122. -keep class com.starbuds.app.entity.**{*;}
  123. #-keep class com.starbuds.app.entity.db.**{*;}
  124. -dontwarn com.starbuds.app.widget.**
  125. -keep class com.starbuds.app.widget.**{*;}
  126. #友盟
  127. -keep class com.umeng.** {*;}
  128. -keep class com.uc.** {*;}
  129. -keepclassmembers class * {
  130. public <init> (org.json.JSONObject);
  131. }
  132. -keepclassmembers enum * {
  133. public static **[] values();
  134. public static ** valueOf(java.lang.String);
  135. }
  136. -keep class com.zui.** {*;}
  137. -keep class com.miui.** {*;}
  138. -keep class com.heytap.** {*;}
  139. -keep class a.** {*;}
  140. -keep class com.vivo.** {*;}
  141. -keep public class com.starbuds.app.R$*{
  142. public static final int *;
  143. }
  144. #字节美颜
  145. -keep class com.bytedance.labcv.effectsdk.**{*;}
  146. #okhttp
  147. -dontwarn com.squareup.okhttp.**
  148. -keep class com.squareup.okhttp.** {*;}
  149. -keep interface com.squareup.okhttp.** {*;}
  150. -dontwarn okio.**
  151. #Glide
  152. -dontwarn com.bumptech.glide.**
  153. -keep class com.bumptech.glide.**{*;}
  154. -keep public class * implements com.bumptech.glide.module.GlideModule
  155. -keep public class * extends com.bumptech.glide.AppGlideModule
  156. -keep public enum com.bumptech.glide.load.resource.bitmap.ImageHeaderParser$** {
  157. **[] $VALUES;
  158. public *;
  159. }
  160. -keep public class * implements com.bumptech.glide.module.GlideModule
  161. -keep class * extends com.bumptech.glide.module.AppGlideModule {
  162. <init>(...);
  163. }
  164. -keep public enum com.bumptech.glide.load.ImageHeaderParser$** {
  165. **[] $VALUES;
  166. public *;
  167. }
  168. -keep class com.bumptech.glide.load.data.ParcelFileDescriptorRewinder$InternalRewinder {
  169. *** rewind();
  170. }
  171. #SVGA
  172. -keep class com.squareup.wire.** { *; }
  173. -keep class com.opensource.svgaplayer.proto.** { *; }
  174. #声网
  175. -keep class io.agora.**{*;}
  176. #闪验
  177. -dontwarn com.cmic.sso.sdk.**
  178. -dontwarn com.sdk.**
  179. -keep class com.cmic.sso.sdk.**{*;}
  180. -keep class com.sdk.** { *;}
  181. -keep class cn.com.chinatelecom.account.api.**{*;}
  182. # 七牛视频混淆
  183. -keep class com.pili.pldroid.player.** { *; }
  184. -keep class com.qiniu.qplayer.mediaEngine.MediaPlayer{*;}
  185. -keep class com.qiniu.pili.droid.**{*;}
  186. -keep class com.qiniu.pili.droid.streaming.** { *; }
  187. # 七牛RTC混淆
  188. -keep class com.youme.** {*;}
  189. -keep class org.webrtc.** {*;}
  190. -keep class com.qiniu.android.dns.** {*;}
  191. -keep class com.qiniu.pili.droid.streaming.** {*;}
  192. -keep class com.sensetime.**{*;}
  193. # 七牛RTC混淆
  194. -keep class org.webrtc.** {*;}
  195. -dontwarn org.webrtc.**
  196. -keep class com.qiniu.droid.rtc.**{*;}
  197. -keep interface com.qiniu.droid.rtc.**{*;}
  198. # 阿里云推送混淆
  199. -keepclasseswithmembernames class ** {
  200. native <methods>;
  201. }
  202. -keep class sun.misc.Unsafe { *; }
  203. -keep class com.taobao.** {*;}
  204. -keep class com.alibaba.** {*;}
  205. -keep class com.alipay.** {*;}
  206. -keep class com.ut.** {*;}
  207. -keep class com.ta.** {*;}
  208. -keep class anet.**{*;}
  209. -keep class anetwork.**{*;}
  210. -keep class org.android.spdy.**{*;}
  211. -keep class org.android.agoo.**{*;}
  212. -keep class android.os.**{*;}
  213. -dontwarn com.taobao.**
  214. -dontwarn com.alibaba.**
  215. -dontwarn com.alipay.**
  216. -dontwarn anet.**
  217. -dontwarn org.android.spdy.**
  218. -dontwarn org.android.agoo.**
  219. -dontwarn anetwork.**
  220. -dontwarn com.ut.**
  221. -dontwarn com.ta.**
  222. -dontwarn com.aliyuncs.**
  223. -keep class com.aliyuncs.**{*;}
  224. # 阿里云RTC
  225. -keep class com.serenegiant.**{*;}
  226. -keep class org.webrtc.**{*;}
  227. -keep class com.alivc.**{*;}
  228. # UCrop
  229. -dontwarn com.yalantis.ucrop**
  230. -keep class com.yalantis.ucrop** { *; }
  231. -keep interface com.yalantis.ucrop** { *; }
  232. # 华为
  233. -ignorewarning
  234. -keepattributes *Annotation*
  235. -keepattributes Exceptions
  236. -keepattributes InnerClasses
  237. -keepattributes Signature
  238. -keepattributes SourceFile,LineNumberTable
  239. -keep class com.hianalytics.android.**{*;}
  240. -keep class com.huawei.updatesdk.**{*;}
  241. -keep class com.huawei.hms.**{*;}
  242. -keep class com.huawei.android.hms.agent.**{*;}
  243. -keep class com.huawei.gamebox.plugin.gameservice.**{*;}
  244. # 定位
  245. -keep class com.amap.api.location.**{*;}
  246. -keep class com.amap.api.fence.**{*;}
  247. -keep class com.loc.**{*;}
  248. -keep class com.autonavi.aps.amapapi.model.**{*;}
  249. # jzvd
  250. -keep public class cn.jzvd.JZMediaSystem {*; }
  251. -keep public class cn.jzvd.demo.CustomMedia.CustomMedia {*; }
  252. -keep public class cn.jzvd.demo.CustomMedia.JZMediaIjk {*; }
  253. -keep public class cn.jzvd.demo.CustomMedia.JZMediaSystemAssertFolder {*; }
  254. -keep class tv.danmaku.ijk.media.player.** {*; }
  255. -dontwarn tv.danmaku.ijk.media.player.*
  256. -keep interface tv.danmaku.ijk.media.player.** { *; }
  257. # 腾讯IM
  258. -keep class com.tencent.** { *; }
  259. # 微信
  260. -keep class com.tencent.mm.opensdk.** {*;}
  261. -keep class com.tencent.wxop.** {*;}
  262. -keep class com.tencent.mm.sdk.** {*;}
  263. # QQ
  264. -keep class com.tencent.imsdk.** {*;}
  265. # 微博
  266. -keep class com.sina.weibo.sdk.** { *; }
  267. # Bugly
  268. -dontwarn com.tencent.bugly.**
  269. -keep public class com.tencent.bugly.**{*;}
  270. -keep class org.greenrobot.greendao.**{*;}
  271. -keepclassmembers class * extends org.greenrobot.greendao.AbstractDao {
  272. public static java.lang.String TABLENAME;
  273. }
  274. -keep class **$Properties
  275. -keep class net.sqlcipher.database.**{*;}
  276. -keep public interface net.sqlcipher.database.**
  277. -dontwarn net.sqlcipher.database.**
  278. -dontwarn org.greenrobot.greendao.**
  279. -keepclassmembers class ** {
  280. @org.greenrobot.eventbus.Subscribe <methods>;
  281. }
  282. -keep enum org.greenrobot.eventbus.ThreadMode { *; }
  283. # Only required if you use AsyncExecutor
  284. -keepclassmembers class * extends org.greenrobot.eventbus.util.ThrowableFailureEvent {
  285. <init>(java.lang.Throwable);
  286. }
  287. # ali
  288. -keepclasseswithmembernames class ** {
  289. native <methods>;
  290. }
  291. -keepattributes Signature
  292. -keep class sun.misc.Unsafe { *; }
  293. -keep class com.taobao.** {*;}
  294. -keep class com.alibaba.** {*;}
  295. -keep class com.alipay.** {*;}
  296. -keep class com.ut.** {*;}
  297. -keep class com.ta.** {*;}
  298. -keep class anet.**{*;}
  299. -keep class anetwork.**{*;}
  300. -keep class org.android.spdy.**{*;}
  301. -keep class org.android.agoo.**{*;}
  302. -keep class android.os.**{*;}
  303. -keep class org.json.**{*;}
  304. -dontwarn com.taobao.**
  305. -dontwarn com.alibaba.**
  306. -dontwarn com.alipay.**
  307. -dontwarn anet.**
  308. -dontwarn org.android.spdy.**
  309. -dontwarn org.android.agoo.**
  310. -dontwarn anetwork.**
  311. -dontwarn com.ut.**
  312. -dontwarn com.ta.**
  313. # 小米通道
  314. -keep class com.xiaomi.** {*;}
  315. -dontwarn com.xiaomi.**
  316. # 华为通道
  317. -keep class com.huawei.** {*;}
  318. -dontwarn com.huawei.**
  319. # GCM/FCM通道
  320. -keep class com.google.firebase.**{*;}
  321. -dontwarn com.google.firebase.**
  322. # OPPO通道
  323. -keep public class * extends android.app.Service
  324. # VIVO通道
  325. -keep class com.vivo.** {*;}
  326. -dontwarn com.vivo.**
  327. # 魅族通道
  328. -keep class com.meizu.cloud.** {*;}
  329. -dontwarn com.meizu.cloud.**
  330. #Rxjava RxAndroid
  331. -dontwarn rx.*
  332. -dontwarn sun.misc.**
  333. -keep class rx.internal.**{*;}
  334. -keepattributes Exceptions,InnerClasses
  335. -keepattributes Signature
  336. -keep class io.rong.** {*;}
  337. -keep class cn.rongcloud.** {*;}
  338. -keep class * implements io.rong.imlib.model.MessageContent {*;}
  339. -dontwarn io.rong.push.**
  340. -dontnote com.xiaomi.**
  341. -dontnote com.google.android.gms.gcm.**
  342. -dontnote io.rong.**
  343. -ignorewarnings
  344. #ImmersionBar
  345. -keep class com.gyf.immersionbar.* {*;}
  346. -dontwarn com.gyf.immersionbar.**
  347. #security
  348. -keep class com.laylib.security.lib.* {*;}
  349. -dontwarn com.laylib.security.lib.**
  350. # 保持调用jni的类不被混淆
  351. -keep class android_serialport_api.*{*;}
  352. # 设置所有 native 方法不被混淆
  353. -keepclasseswithmembernames class * {
  354. native <methods>;
  355. }