proguard-rules.pro 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209
  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 class android.support.** {*;}
  23. -keepclasseswithmembernames class * {
  24. native <methods>;
  25. }
  26. -keepclassmembers class * extends android.app.Activity{
  27. public void *(android.view.View);
  28. }
  29. -keepclassmembers enum * {
  30. public static **[] values();
  31. public static ** valueOf(java.lang.String);
  32. }
  33. -keep public class * extends android.view.View{
  34. *** get*();
  35. void set*(***);
  36. public <init>(android.content.Context);
  37. public <init>(android.content.Context, android.util.AttributeSet);
  38. public <init>(android.content.Context, android.util.AttributeSet, int);
  39. }
  40. -keepclasseswithmembers class * {
  41. public <init>(android.content.Context, android.util.AttributeSet);
  42. public <init>(android.content.Context, android.util.AttributeSet, int);
  43. }
  44. -keep class * implements android.os.Parcelable {
  45. public static final android.os.Parcelable$Creator *;
  46. }
  47. -keepclassmembers class * implements java.io.Serializable {
  48. static final long serialVersionUID;
  49. private static final java.io.ObjectStreamField[] serialPersistentFields;
  50. private void writeObject(java.io.ObjectOutputStream);
  51. private void readObject(java.io.ObjectInputStream);
  52. java.lang.Object writeReplace();
  53. java.lang.Object readResolve();
  54. }
  55. # ActionBarSherlock
  56. -keep class android.support.** { *; }
  57. -keep interface android.support.** { *; }
  58. -keep class com.actionbarsherlock.** { *; }
  59. -keep interface com.actionbarsherlock.** { *; }
  60. # Keep line numbers to alleviate debugging stack traces
  61. -renamesourcefileattribute SourceFile
  62. -keep class **.R$* {
  63. *;
  64. }
  65. -ignorewarnings
  66. -keep class * {
  67. public private *;
  68. }
  69. -keepclassmembers class * {
  70. void *(**On*Event);
  71. }
  72. -keep class * implements com.guadou.lib_baselib.base.mvi.BaseViewState
  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 enum com.bumptech.glide.load.resource.bitmap.ImageHeaderParser$** {
  84. **[] $VALUES;
  85. public *;
  86. }
  87. # Gson
  88. -keepattributes *Annotation*
  89. -keepattributes Signature
  90. -dontwarn sun.misc.**
  91. -keep class com.google.gson.stream.** { *; }
  92. -keep class com.google.gson.examples.android.model.** { *; }
  93. -keep class * implements com.google.gson.TypeAdapterFactory
  94. -keep class * implements com.google.gson.JsonSerializer
  95. -keep class * implements com.google.gson.JsonDeserializer
  96. # Retrofit
  97. -dontwarn retrofit2.**
  98. -keep class retrofit2.** { *; }
  99. -keepattributes Signature
  100. -keepattributes Exceptions
  101. # converters and adapters. 是否要注释
  102. -keepclassmembernames,allowobfuscation interface * {
  103. @retrofit2.http.* <methods>;
  104. }
  105. -dontwarn org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement
  106. #Retrofit+rxjava+rxandroid+gson+okhttp
  107. -dontwarn javax.annotation.**
  108. -dontwarn javax.inject.**
  109. #AndPermission
  110. -dontwarn com.yanzhenjie.permission.**
  111. #极光推送
  112. -dontoptimize
  113. -dontpreverify
  114. -dontwarn cn.jpush.**
  115. -keep class cn.jpush.** { *; }
  116. #okhttp
  117. -dontwarn okhttp3.**
  118. -keep class okhttp3.**{*;}
  119. #okio
  120. -dontwarn okio.**
  121. -keep class okio.**{*;}
  122. #brvah
  123. -keep class com.chad.library.adapter.** {
  124. *;
  125. }
  126. -keep public class * extends com.chad.library.adapter.base.BaseQuickAdapter
  127. -keep public class * extends com.chad.library.adapter.base.viewholder.BaseViewHolder
  128. -keepclassmembers class **$** extends com.chad.library.adapter.base.viewholder.BaseViewHolder {
  129. <init>(...);
  130. }
  131. #==================其他==========================
  132. -dontwarn com.google.**
  133. -keep class com.google.gson.** {*;}
  134. -keep class com.google.protobuf.** {*;}
  135. -keep class com.google.gson.examples.android.model.** { *; }
  136. -keep class * implements com.google.gson.TypeAdapterFactory
  137. -keep class * implements com.google.gson.JsonSerializer
  138. -keep class * implements com.google.gson.JsonDeserializer
  139. #Gson容错处理
  140. -keep class com.ke.gson.** { *; }
  141. ##腾讯系列
  142. #-keep class com.tencent.** { *; }
  143. #LiveBus
  144. -dontwarn com.jeremyliao.liveeventbus.**
  145. -keep class com.jeremyliao.liveeventbus.** { *; }
  146. -keep class androidx.lifecycle.** { *; }
  147. -keep class androidx.arch.core.** { *; }
  148. # Rules for Kotlin Coroutines
  149. -keepnames class kotlinx.coroutines.internal.MainDispatcherFactory {}
  150. -keepnames class kotlinx.coroutines.CoroutineExceptionHandler {}
  151. -keepnames class kotlinx.coroutines.android.AndroidExceptionPreHandler {}
  152. -keepnames class kotlinx.coroutines.android.AndroidDispatcherFactory {}
  153. -keepclassmembernames class kotlinx.** {
  154. volatile <fields>;
  155. }
  156. #PictureSelector 2.0
  157. -keep class com.luck.picture.lib.** { *; }
  158. #Ucrop
  159. -dontwarn com.yalantis.ucrop**
  160. -keep class com.yalantis.ucrop** { *; }
  161. -keep interface com.yalantis.ucrop** { *; }
  162. #Okio
  163. -dontwarn org.codehaus.mojo.animal_sniffer.*
  164. #ARouter
  165. -keep public class com.alibaba.android.arouter.routes.**{*;}
  166. -keep public class com.alibaba.android.arouter.facade.**{*;}
  167. -keep class * implements com.alibaba.android.arouter.facade.template.ISyringe{*;}
  168. # 如果使用了 byType 的方式获取 Service,需添加下面规则,保护接口
  169. -keep interface * implements com.alibaba.android.arouter.facade.template.IProvider
  170. # 如果使用了 单类注入,即不定义接口实现 IProvider,需添加下面规则,保护实现
  171. # -keep class * implements com.alibaba.android.arouter.facade.template.IProvider