proguard-rules.pro 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228
  1. #---------------------------------基本指令区----------------------------------
  2. -optimizationpasses 5
  3. -dontusemixedcaseclassnames
  4. -dontskipnonpubliclibraryclasses
  5. -dontskipnonpubliclibraryclassmembers
  6. -dontpreverify
  7. -verbose
  8. -printmapping proguardMapping.txt
  9. -optimizations !code/simplification/cast,!field/*,!class/merging/*
  10. -keepattributes *Annotation*,InnerClasses
  11. -keepattributes Signature
  12. -keepattributes SourceFile,LineNumberTable
  13. #---------------------------------默认保留区---------------------------------
  14. -keep public class * extends android.app.Activity
  15. -keep public class * extends android.app.Application
  16. -keep public class * extends android.app.Service
  17. -keep public class * extends android.content.BroadcastReceiver
  18. -keep public class * extends android.content.ContentProvider
  19. -keep public class * extends android.app.backup.BackupAgentHelper
  20. -keep public class * extends android.preference.Preference
  21. -keep public class * extends android.view.View
  22. -keep public class com.android.vending.licensing.ILicensingService
  23. -keep class android.support.** {*;}
  24. -keepclasseswithmembernames class * {
  25. native <methods>;
  26. }
  27. -keepclassmembers class * extends android.app.Activity{
  28. public void *(android.view.View);
  29. }
  30. -keepclassmembers enum * {
  31. public static **[] values();
  32. public static ** valueOf(java.lang.String);
  33. }
  34. -keep public class * extends android.view.View{
  35. *** get*();
  36. void set*(***);
  37. public <init>(android.content.Context);
  38. public <init>(android.content.Context, android.util.AttributeSet);
  39. public <init>(android.content.Context, android.util.AttributeSet, int);
  40. }
  41. -keepclasseswithmembers class * {
  42. public <init>(android.content.Context, android.util.AttributeSet);
  43. public <init>(android.content.Context, android.util.AttributeSet, int);
  44. }
  45. -keep class * implements android.os.Parcelable {
  46. public static final android.os.Parcelable$Creator *;
  47. }
  48. -keepclassmembers class * implements java.io.Serializable {
  49. static final long serialVersionUID;
  50. private static final java.io.ObjectStreamField[] serialPersistentFields;
  51. private void writeObject(java.io.ObjectOutputStream);
  52. private void readObject(java.io.ObjectInputStream);
  53. java.lang.Object writeReplace();
  54. java.lang.Object readResolve();
  55. }
  56. # ActionBarSherlock
  57. -keep class android.support.** { *; }
  58. -keep interface android.support.** { *; }
  59. -keep class com.actionbarsherlock.** { *; }
  60. -keep interface com.actionbarsherlock.** { *; }
  61. # Keep line numbers to alleviate debugging stack traces
  62. -renamesourcefileattribute SourceFile
  63. -keep class **.R$* {
  64. *;
  65. }
  66. -ignorewarnings
  67. -keep class * {
  68. public private *;
  69. }
  70. -keepclassmembers class * {
  71. void *(**On*Event);
  72. }
  73. #----------------------------------------------------------------------------
  74. #---------------------------------1.实体类---------------------------------
  75. -keep class com.guadou.kt_zoom.bean.** { *; }
  76. -keep class com.guadou.lib_baselib.bean.** { *; }
  77. #--------------------------------第三方混淆--------------------------------------------
  78. # OkHttp3
  79. -dontwarn okhttp3.logging.**
  80. -keep class okhttp3.internal.**{*;}
  81. -dontwarn okio.**
  82. #glide
  83. -keep public class * implements com.bumptech.glide.module.GlideModule
  84. -keep public enum com.bumptech.glide.load.resource.bitmap.ImageHeaderParser$** {
  85. **[] $VALUES;
  86. public *;
  87. }
  88. # Gson
  89. -keepattributes *Annotation*
  90. -keepattributes Signature
  91. -dontwarn sun.misc.**
  92. -keep class com.google.gson.stream.** { *; }
  93. -keep class com.google.gson.examples.android.model.** { *; }
  94. -keep class * implements com.google.gson.TypeAdapterFactory
  95. -keep class * implements com.google.gson.JsonSerializer
  96. -keep class * implements com.google.gson.JsonDeserializer
  97. # Retrofit
  98. -dontwarn retrofit2.**
  99. -keep class retrofit2.** { *; }
  100. -keepattributes Signature
  101. -keepattributes Exceptions
  102. # converters and adapters. 是否要注释
  103. -keepclassmembernames,allowobfuscation interface * {
  104. @retrofit2.http.* <methods>;
  105. }
  106. -dontwarn org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement
  107. # RxJava RxAndroid
  108. -dontwarn sun.misc.**
  109. -keepclassmembers class rx.internal.util.unsafe.*ArrayQueue*Field* {
  110. long producerIndex;
  111. long consumerIndex;
  112. }
  113. -keepclassmembers class rx.internal.util.unsafe.BaseLinkedQueueProducerNodeRef {
  114. rx.internal.util.atomic.LinkedQueueNode producerNode;
  115. }
  116. -keepclassmembers class rx.internal.util.unsafe.BaseLinkedQueueConsumerNodeRef {
  117. rx.internal.util.atomic.LinkedQueueNode consumerNode;
  118. }
  119. #Retrofit+rxjava+rxandroid+gson+okhttp
  120. -dontwarn javax.annotation.**
  121. -dontwarn javax.inject.**
  122. #AndPermission
  123. -dontwarn com.yanzhenjie.permission.**
  124. #激光推送
  125. -dontoptimize
  126. -dontpreverify
  127. -dontwarn cn.jpush.**
  128. -keep class cn.jpush.** { *; }
  129. #okhttp
  130. -dontwarn okhttp3.**
  131. -keep class okhttp3.**{*;}
  132. #okio
  133. -dontwarn okio.**
  134. -keep class okio.**{*;}
  135. #brvah
  136. -keep class com.chad.library.adapter.** {
  137. *;
  138. }
  139. -keep public class * extends com.chad.library.adapter.base.BaseQuickAdapter
  140. -keep public class * extends com.chad.library.adapter.base.BaseViewHolder
  141. -keepclassmembers class **$** extends com.chad.library.adapter.base.BaseViewHolder {
  142. <init>(...);
  143. }
  144. #==================其他==========================
  145. -dontwarn com.google.**
  146. -keep class com.google.gson.** {*;}
  147. -keep class com.google.protobuf.** {*;}
  148. -keep class com.google.gson.examples.android.model.** { *; }
  149. -keep class * implements com.google.gson.TypeAdapterFactory
  150. -keep class * implements com.google.gson.JsonSerializer
  151. -keep class * implements com.google.gson.JsonDeserializer
  152. #Gson容错处理
  153. -keep class com.ke.gson.** { *; }
  154. ##腾讯系列
  155. #-keep class com.tencent.** { *; }
  156. #LiveBus
  157. -dontwarn com.jeremyliao.liveeventbus.**
  158. -keep class com.jeremyliao.liveeventbus.** { *; }
  159. -keep class androidx.lifecycle.** { *; }
  160. -keep class androidx.arch.core.** { *; }
  161. # Rules for Kotlin Coroutines
  162. -keepnames class kotlinx.coroutines.internal.MainDispatcherFactory {}
  163. -keepnames class kotlinx.coroutines.CoroutineExceptionHandler {}
  164. -keepnames class kotlinx.coroutines.android.AndroidExceptionPreHandler {}
  165. -keepnames class kotlinx.coroutines.android.AndroidDispatcherFactory {}
  166. -keepclassmembernames class kotlinx.** {
  167. volatile <fields>;
  168. }
  169. #PictureSelector 2.0
  170. -keep class com.luck.picture.lib.** { *; }
  171. #Ucrop
  172. -dontwarn com.yalantis.ucrop**
  173. -keep class com.yalantis.ucrop** { *; }
  174. -keep interface com.yalantis.ucrop** { *; }
  175. #Okio
  176. -dontwarn org.codehaus.mojo.animal_sniffer.*
  177. #Cookiejar混淆
  178. -dontwarn com.franmontiel.persistentcookiejar.**
  179. -keep class com.franmontiel.persistentcookiejar.**
  180. -keepclassmembers class * implements java.io.Serializable {
  181. static final long serialVersionUID;
  182. private static final java.io.ObjectStreamField[] serialPersistentFields;
  183. !static !transient <fields>;
  184. private void writeObject(java.io.ObjectOutputStream);
  185. private void readObject(java.io.ObjectInputStream);
  186. java.lang.Object writeReplace();
  187. java.lang.Object readResolve();
  188. }