proguard-rules.pro 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222
  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. -dontusemixedcaseclassnames
  22. -dontskipnonpubliclibraryclasses
  23. -dontpreverify
  24. -verbose
  25. -optimizations !code/simplification/arithmetic,!field/*,!class/merging/*
  26. # ------ 官方模板推荐不需要混淆的组件 ------
  27. -keep public class * extends android.app.Application
  28. -keep public class * extends android.app.Activity
  29. -keep public class * extends android.app.Service
  30. -keep public class * extends android.content.ContentProvider
  31. -keep public class * extends android.content.BroadcastReceiver
  32. -keep public class * extends android.app.backup.BackupAgentHelper
  33. -keep public class * extends android.preference.Preference
  34. -keep public class * extends android.widget.PopupWindow
  35. -keep public class * extends androidx.fragment.app.Fragment
  36. -keep class * extends android.webkit.WebChromeClient {*;}
  37. -keep class * extends android.webkit.WebViewClient {*;}
  38. -keep public class com.android.vending.licensing.ILicensingService
  39. # 忽略自定义控件
  40. -keep public class * extends android.view.View {
  41. public <init>(android.content.Context);
  42. public <init>(android.content.Context, android.util.AttributeSet);
  43. public <init>(android.content.Context, android.util.AttributeSet, int);
  44. public void set*(...);
  45. *** get*();
  46. }
  47. -keepclassmembers class * extends android.app.Activity{
  48. public void *(android.view.View);
  49. }
  50. ## 禁止混淆枚举类型
  51. -keepclassmembers,allowoptimization enum * {
  52. public static **[] values();
  53. public static ** valueOf(java.lang.String);
  54. }
  55. # 忽略原生方法
  56. -keepclasseswithmembernames class * {
  57. native <methods>;
  58. }
  59. # 忽略枚举
  60. -keepclassmembers enum * {
  61. public static **[] values();
  62. public static ** valueOf(java.lang.String);
  63. }
  64. # 忽略序列化实体类
  65. -keep class * implements android.os.Parcelable {
  66. public static final android.os.Parcelable$Creator *;
  67. }
  68. -keepnames class * implements java.io.Serializable
  69. -keepclassmembers class * implements java.io.Serializable {
  70. static final long serialVersionUID;
  71. private static final java.io.ObjectStreamField[] serialPersistentFields;
  72. !static !transient <fields>;
  73. private void writeObject(java.io.ObjectOutputStream);
  74. private void readObject(java.io.ObjectInputStream);
  75. java.lang.Object writeReplace();
  76. java.lang.Object readResolve();
  77. }
  78. # 保留Annotation不混淆
  79. -keepattributes *Annotation*,InnerClasses
  80. # 避免混淆泛型
  81. -keepattributes Signature
  82. -keepattributes SourceFile,LineNumberTable
  83. # 保持R文件不被混淆
  84. -keep public class **.R$* {*;}
  85. # ------ 应用定制混淆方案 ------
  86. -keep class **.*$JavaScriptInterface{*;}
  87. -keepclassmembers class * {
  88. public <init> (org.json.JSONObject);
  89. }
  90. -keep class com.buyao.common.activity.**{*;}
  91. -keep class com.buyao.common.fragment.**{*;}
  92. -keep class com.buyao.common.adapter.**{*;}
  93. -keep class com.buyao.common.dialog.**{*;}
  94. -keep class com.buyao.**.model.** {*;}
  95. -keep class com.buyao.**.vo.** {*;}
  96. -keep class com.buyao.**.event.** {*;}
  97. -keep public class * extends androidx.**
  98. -dontwarn androidx.**
  99. # Gson
  100. -keep class com.google.gson.** {*;}
  101. -dontwarn com.google.gson.**
  102. # Glide
  103. -keep public class * implements com.bumptech.glide.module.GlideModule
  104. -keep class * extends com.bumptech.glide.module.AppGlideModule {
  105. <init>(...);
  106. }
  107. -keep public enum com.bumptech.glide.load.ImageHeaderParser$** {
  108. **[] $VALUES;
  109. public *;
  110. }
  111. -keep class com.bumptech.glide.load.data.ParcelFileDescriptorRewinder$InternalRewinder {
  112. *** rewind();
  113. }
  114. # for DexGuard only
  115. #-keepresourcexmlelements manifest/application/meta-data@value=GlideModule
  116. # RxJava
  117. -keep class io.reactivex.**{*;}
  118. -dontwarn io.reactivex.**
  119. -keep class org.reactivestreams.**{*;}
  120. -dontwarn org.reactivestreams.**
  121. # retrofit2
  122. -dontnote retrofit2.Platform
  123. -dontwarn retrofit2.Platform$Java8
  124. -dontnote retrofit2.Platform$IOS$MainThreadExecutor
  125. -keepattributes Exceptions
  126. -keepclassmembers,allowshrinking,allowobfuscation interface * {
  127. @retrofit2.http.* <methods>;
  128. }
  129. -dontwarn javax.annotation.**
  130. # okhttp3
  131. -keep class okhttp3.**{*;}
  132. -dontwarn okhttp3.**
  133. -keep class okio.**{*;}
  134. -dontwarn okio.**
  135. #OSS
  136. -keep class com.alibaba.sdk.android.oss.** { *; }
  137. -dontwarn org.apache.commons.codec.binary.**
  138. #Aliyun短视频
  139. -keep class com.aliyun.**{*;}
  140. -keep class com.duanqu.**{*;}
  141. -keep class com.qu.**{*;}
  142. -keep class com.alibaba.**{*;}
  143. -keep class component.alivc.**{*;}
  144. -keep class com.alivc.**{*;}
  145. # SwipeToLoadLayout
  146. -keep class com.aspsine.swipetoloadlayout.**{*;}
  147. -dontwarn com.aspsine.swipetoloadlayout.**
  148. #友盟
  149. -keep class com.umeng.** {*;}
  150. -keep class com.uc.** {*;}
  151. -keepclassmembers class * {
  152. public <init> (org.json.JSONObject);
  153. }
  154. -keepclassmembers enum * {
  155. public static **[] values();
  156. public static ** valueOf(java.lang.String);
  157. }
  158. -keep class com.zui.** {*;}
  159. -keep class com.miui.** {*;}
  160. -keep class com.heytap.** {*;}
  161. -keep class a.** {*;}
  162. -keep class com.vivo.** {*;}
  163. #oaid
  164. -keep class com.bun.miitmdid.core.** {*;}
  165. #声网
  166. -keep class io.agora.**{*;}
  167. #微信
  168. -keep class com.tencent.mm.opensdk.** {*;}
  169. -keep class com.tencent.wxop.** {*;}
  170. -keep class com.tencent.mm.sdk.** {*;}
  171. -keep class com.tencent.mmkv.** {*;}
  172. #gsyvideoplayer
  173. -keep class com.shuyu.gsyvideoplayer.video.** { *; }
  174. -dontwarn com.shuyu.gsyvideoplayer.video.**
  175. -keep class com.shuyu.gsyvideoplayer.video.base.** { *; }
  176. -dontwarn com.shuyu.gsyvideoplayer.video.base.**
  177. -keep class com.shuyu.gsyvideoplayer.utils.** { *; }
  178. -dontwarn com.shuyu.gsyvideoplayer.utils.**
  179. -keep class tv.danmaku.ijk.** { *; }
  180. -dontwarn tv.danmaku.ijk.**
  181. ## 禁止混淆二维码解析SDK
  182. #-libraryjars libs/facesdk.jar
  183. -dontwarn com.baidu.idl.**
  184. -keep class com.baidu.idl.**{*;}
  185. #融云
  186. -keep class io.rong.** {*;}
  187. -keep class cn.rongcloud.** {*;}
  188. -keep class * implements io.rong.imlib.model.MessageContent {*;}
  189. -keep class io.rong.app.DemoNotificationReceiver {*;}
  190. -dontwarn io.rong.push.**
  191. -dontnote com.xiaomi.**
  192. -dontnote com.google.android.gms.gcm.**
  193. -dontnote io.rong.**
  194. # Location
  195. -keep class com.amap.api.**{*;}
  196. -keep class com.amap.api.services.**{*;}
  197. #huawei push
  198. -keep class com.hianalytics.android.**{*;}
  199. -keep class com.huawei.updatesdk.**{*;}
  200. -keep class com.huawei.hms.**{*;}
  201. -keep class com.huawei.gamebox.plugin.gameservice.**{*;}
  202. -keep public class com.huawei.android.hms.agent.** extends android.app.Activity { public *; protected *; }
  203. -keep interface com.huawei.android.hms.agent.common.INoProguard {*;}
  204. -keep class * extends com.huawei.android.hms.agent.common.INoProguard {*;}