proguard-rules.pro 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200
  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. #-dontobfuscate
  25. #-dontoptimize
  26. -verbose
  27. -optimizations !code/simplification/arithmetic,!field/*,!class/merging/*
  28. # ------ 官方模板推荐不需要混淆的组件 ------
  29. -keep public class * extends android.app.Application
  30. -keep public class * extends android.app.Activity
  31. -keep public class * extends android.app.Service
  32. -keep public class * extends android.content.ContentProvider
  33. -keep public class * extends android.content.BroadcastReceiver
  34. -keep public class * extends android.app.backup.BackupAgentHelper
  35. -keep public class * extends android.preference.Preference
  36. -keep public class * extends android.widget.PopupWindow
  37. -keep public class * extends androidx.fragment.app.Fragment
  38. -keep class * extends android.webkit.WebChromeClient {*;}
  39. -keep class * extends android.webkit.WebViewClient {*;}
  40. -keep public class com.android.vending.licensing.ILicensingService
  41. # 忽略自定义控件
  42. -keep public class * extends android.view.View {
  43. public <init>(android.content.Context);
  44. public <init>(android.content.Context, android.util.AttributeSet);
  45. public <init>(android.content.Context, android.util.AttributeSet, int);
  46. public void set*(...);
  47. *** get*();
  48. }
  49. -keepclassmembers class * extends android.app.Activity{
  50. public void *(android.view.View);
  51. }
  52. ## 禁止混淆枚举类型
  53. -keepclassmembers,allowoptimization enum * {
  54. public static **[] values();
  55. public static ** valueOf(java.lang.String);
  56. }
  57. # 忽略原生方法
  58. -keepclasseswithmembernames class * {
  59. native <methods>;
  60. }
  61. # 忽略枚举
  62. -keepclassmembers enum * {
  63. public static **[] values();
  64. public static ** valueOf(java.lang.String);
  65. }
  66. # 忽略序列化实体类
  67. -keep class * implements android.os.Parcelable {
  68. public static final android.os.Parcelable$Creator *;
  69. }
  70. -keepnames class * implements java.io.Serializable
  71. -keepclassmembers class * implements java.io.Serializable {
  72. static final long serialVersionUID;
  73. private static final java.io.ObjectStreamField[] serialPersistentFields;
  74. !static !transient <fields>;
  75. private void writeObject(java.io.ObjectOutputStream);
  76. private void readObject(java.io.ObjectInputStream);
  77. java.lang.Object writeReplace();
  78. java.lang.Object readResolve();
  79. }
  80. # 保留Annotation不混淆
  81. -keepattributes *Annotation*,InnerClasses
  82. # 避免混淆泛型
  83. -keepattributes Signature
  84. -keepattributes SourceFile,LineNumberTable
  85. -keepattributes EnclosingMethod
  86. # 保持R文件不被混淆
  87. -keep public class **.R$* {*;}
  88. # ------ 应用定制混淆方案 ------
  89. -keep class **.*$JavaScriptInterface{*;}
  90. -keepclassmembers class * {
  91. public <init> (org.json.JSONObject);
  92. }
  93. -keep class beer.toktok.common.activity.**{*;}
  94. -keep class beer.toktok.common.fragment.**{*;}
  95. -keep class beer.toktok.common.adapter.**{*;}
  96. -keep class beer.toktok.common.dialog.**{*;}
  97. -keep class beer.toktok.**.model.**{*;}
  98. -keep class beer.toktok.**.vo.**{*;}
  99. -keep class beer.toktok.**.event.**{*;}
  100. -keep class beer.toktok.**.open.**{*;}
  101. -keep public class * extends androidx.**
  102. -dontwarn androidx.**
  103. # Gson
  104. -keep class com.google.gson.** {*;}
  105. -dontwarn com.google.gson.**
  106. -keep class org.json.** {*;}
  107. -dontwarn sun.misc.**
  108. -keep class sun.misc.Unsafe { *; }
  109. -keep class * extends com.google.gson.TypeAdapter
  110. -keep class * implements com.google.gson.TypeAdapterFactory
  111. -keep class * implements com.google.gson.JsonSerializer
  112. -keep class * implements com.google.gson.JsonDeserializer
  113. -keepclassmembers,allowobfuscation class * {
  114. @com.google.gson.annotations.SerializedName <fields>;
  115. }
  116. -keep,allowobfuscation,allowshrinking class com.google.gson.reflect.TypeToken
  117. -keep,allowobfuscation,allowshrinking class * extends com.google.gson.reflect.TypeToken
  118. # Glide
  119. -keep public class * implements com.bumptech.glide.module.GlideModule
  120. -keep class * extends com.bumptech.glide.module.AppGlideModule {
  121. <init>(...);
  122. }
  123. -keep public enum com.bumptech.glide.load.ImageHeaderParser$** {
  124. **[] $VALUES;
  125. public *;
  126. }
  127. -keep class com.bumptech.glide.load.data.ParcelFileDescriptorRewinder$InternalRewinder {
  128. *** rewind();
  129. }
  130. # for DexGuard only
  131. #-keepresourcexmlelements manifest/application/meta-data@value=GlideModule
  132. # retrofit2
  133. -dontnote retrofit2.Platform
  134. -dontwarn retrofit2.Platform$Java8
  135. -dontnote retrofit2.Platform$IOS$MainThreadExecutor
  136. -keepattributes Exceptions
  137. -keepclassmembers,allowshrinking,allowobfuscation interface * {
  138. @retrofit2.http.* <methods>;
  139. }
  140. -dontwarn javax.annotation.**
  141. # okhttp3
  142. -keep class okhttp3.**{*;}
  143. -dontwarn okhttp3.**
  144. -keep class okio.**{*;}
  145. -dontwarn okio.**
  146. #微信
  147. -keep class com.tencent.mm.opensdk.** {*;}
  148. -keep class com.tencent.wxop.** {*;}
  149. -keep class com.tencent.mm.sdk.** {*;}
  150. -keep class com.tencent.mmkv.** {*;}
  151. #X5
  152. -dontwarn dalvik.**
  153. -dontwarn com.tencent.smtt.**
  154. -keep class com.tencent.smtt.** {
  155. *;
  156. }
  157. -keep class com.tencent.tbs.** {
  158. *;
  159. }
  160. #shanyan
  161. -dontwarn com.cmic.gen.sdk.**
  162. -keep class com.cmic.gen.sdk.**{*;}
  163. -dontwarn com.sdk.**
  164. -keep class com.sdk.** { *;}
  165. -dontwarn com.unikuwei.mianmi.account.shield.**
  166. -keep class com.unikuwei.mianmi.account.shield.** {*;}
  167. -keep class cn.com.chinatelecom.account.**{*;}
  168. -dontwarn com.chuanglan.shanyan_sdk.**
  169. -keep class com.chuanglan.shanyan_sdk.** { *;}
  170. #oss
  171. -keep class com.alibaba.sdk.android.oss.** { *; }
  172. -dontwarn okio.**
  173. -dontwarn org.apache.commons.codec.binary.**
  174. #umeng
  175. -keep public class javax.**
  176. -dontwarn com.umeng.**
  177. -dontwarn com.squareup.okhttp.**
  178. -keep public class android.webkit.**
  179. -keep public interface com.umeng.socialize.**
  180. -keep public interface com.umeng.socialize.sensor.**
  181. -keep public interface com.umeng.scrshot.**
  182. -keep public class com.umeng.socialize.* {*;}
  183. -keep class com.umeng.** {*;}
  184. -keep class com.umeng.**
  185. #other
  186. -dontwarn com.baidu.**
  187. -keep class com.baidu.**{*;}