proguard-rules.pro 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240
  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. -keepattributes InnerClasses
  20. # 指定代码的压缩级别 0 - 7(指定代码进行迭代优化的次数,在Android里面默认是5,这条指令也只有在可以优化时起作用。)
  21. -optimizationpasses 5
  22. # 指定不去忽略非公共的库类(不跳过library中的非public的类)
  23. -dontskipnonpubliclibraryclasses
  24. # 指定不去忽略包可见的库类的成员
  25. #-dontskipnonpubliclibraryclassmembers
  26. #不进行优化,建议使用此选项,
  27. -dontoptimize
  28. # 不进行预校验,Android不需要,可加快混淆速度。
  29. -dontpreverify
  30. # 屏蔽警告
  31. -ignorewarnings
  32. # 指定混淆是采用的算法,后面的参数是一个过滤器
  33. # 这个过滤器是谷歌推荐的算法,一般不做更改
  34. -optimizations !code/simplification/arithmetic,!field/*,!class/merging/*
  35. # 保护代码中的Annotation不被混淆
  36. -keepattributes *Annotation*
  37. # 避免混淆泛型, 这在JSON实体映射时非常重要
  38. -keepattributes Signature
  39. # 抛出异常时保留代码行号
  40. -keepattributes SourceFile,LineNumberTable
  41. #优化时允许访问并修改有修饰符的类和类的成员,这可以提高优化步骤的结果。
  42. # 比如,当内联一个公共的getter方法时,这也可能需要外地公共访问。
  43. # 虽然java二进制规范不需要这个,要不然有的虚拟机处理这些代码会有问题。当有优化和使用-repackageclasses时才适用。
  44. #指示语:不能用这个指令处理库中的代码,因为有的类和类成员没有设计成public ,而在api中可能变成public
  45. #-allowaccessmodification
  46. #当有优化和使用-repackageclasses时才适用。
  47. -repackageclasses ''
  48. # 混淆时记录日志(打印混淆的详细信息)
  49. # 这句话能够使我们的项目混淆后产生映射文件
  50. # 包含有类名->混淆后类名的映射关系
  51. -verbose
  52. -keepattributes InnerClasses
  53. -keepparameternames
  54. -keepattributes Signature #泛型
  55. #native方法不混淆
  56. -keepclasseswithmembernames class * {
  57. native <methods>;
  58. }
  59. #v4包不混淆
  60. -keep class android.support.v4.app.** { *; }
  61. -keep interface android.support.v4.app.** { *; }
  62. ##Glide
  63. -dontwarn com.bumptech.glide.**
  64. -keep class com.bumptech.glide.**{*;}
  65. -keep public class * implements com.bumptech.glide.module.GlideModule
  66. -keep public class * extends com.bumptech.glide.AppGlideModule
  67. -keep public enum com.bumptech.glide.load.resource.bitmap.ImageHeaderParser$** {
  68. **[] $VALUES;
  69. public *;
  70. }
  71. #compdfkit库
  72. -keep class com.compdfkit.core.**{*;}
  73. -keep enum com.compdfkit.core.**{*;}
  74. -keep interface com.compdfkit.core.**{*;}
  75. #compdfkit-ui库
  76. -keep class com.compdfkit.ui.attribute.**{*;}
  77. -keep enum com.compdfkit.ui.attribute.**{*;}
  78. -keep interface com.compdfkit.ui.attribute.**{*;}
  79. -keep class com.compdfkit.ui.contextmenu.**{*;}
  80. -keep enum com.compdfkit.ui.contextmenu.**{*;}
  81. -keep interface com.compdfkit.ui.contextmenu.**{*;}
  82. -keep class com.compdfkit.ui.proxy.**{*;}
  83. -keep enum com.compdfkit.ui.proxy.**{*;}
  84. -keep interface com.compdfkit.ui.proxy.**{*;}
  85. -keep class com.compdfkit.ui.edit.**{*;}
  86. -keep enum com.compdfkit.ui.edit.**{*;}
  87. -keep interface com.compdfkit.ui.edit.**{*;}
  88. -keep interface com.compdfkit.ui.reader.CPDFAddAnnotCallback{*;}
  89. -keep interface com.compdfkit.ui.reader.IPDFErrorMessageCallback{*;}
  90. -keep enum com.compdfkit.ui.reader.IPDFErrorMessageCallback$ErrorId{*;}
  91. -keep interface com.compdfkit.ui.reader.IReaderViewCallback{*;}
  92. -keep interface com.compdfkit.ui.reader.InkUndoRedoCallback{*;}
  93. -keep interface com.compdfkit.ui.reader.OnFocusedTypeChangedListener{*;}
  94. -keep interface com.compdfkit.ui.reader.OnTouchModeChangedListener{*;}
  95. -keep interface com.compdfkit.ui.reader.IDocumentStatusCallback{*;}
  96. -keep class com.compdfkit.ui.reader.CPDFPageView {
  97. public *;
  98. }
  99. -keep class com.compdfkit.ui.reader.PageView {
  100. public *;
  101. }
  102. -keep class com.compdfkit.ui.reader.CPDFReaderView {
  103. public *;
  104. }
  105. -keep class com.compdfkit.ui.reader.ReaderView {
  106. public *;
  107. }
  108. -keep enum com.compdfkit.ui.reader.CPDFPageView$*{*;}
  109. -keep interface com.compdfkit.ui.reader.CPDFPageView$*{*;}
  110. -keep enum com.compdfkit.ui.reader.PageView$*{*;}
  111. -keep interface com.compdfkit.ui.reader.PageView$*{*;}
  112. -keep enum com.compdfkit.ui.reader.CPDFReaderView$*{*;}
  113. -keep interface com.compdfkit.ui.reader.CPDFReaderView$*{*;}
  114. -keep class com.compdfkit.ui.reader.CPDFReaderView$*{*;}
  115. -keep enum com.compdfkit.ui.reader.ReaderView$*{*;}
  116. -keep interface com.compdfkit.ui.reader.ReaderView$*{*;}
  117. -keep class com.compdfkit.ui.textsearch.**{*;}
  118. -keep enum com.compdfkit.ui.textsearch.**{*;}
  119. -keep interface com.compdfkit.ui.textsearch.**{*;}
  120. -keep class com.compdfkit.ui.utils.**{*;}
  121. -keep enum com.compdfkit.ui.utils.**{*;}
  122. -keep interface com.compdfkit.ui.utils.**{*;}
  123. -keep class com.compdfkit.ui.widget.**{*;}
  124. -keep enum com.compdfkit.ui.widget.**{*;}
  125. -keep interface com.compdfkit.ui.widget.**{*;}
  126. -keep class com.compdfkit.tools.**{*;}
  127. -keep enum com.compdfkit.tools.**{*;}
  128. -keep interface com.compdfkit.tools.**{*;}
  129. #############optimize##############
  130. -optimizations !code/simplification/arithmetic,!code/simplification/cast,!field/*,!class/merging/*
  131. -optimizationpasses 5
  132. #-allowaccessmodification //不允许改变方法声明
  133. -dontusemixedcaseclassnames
  134. -dontskipnonpubliclibraryclasses
  135. -verbose
  136. # Preserve some attributes that may be required for reflection.
  137. -keepattributes *Annotation*,Signature,InnerClasses,EnclosingMethod
  138. # For native methods, see http://proguard.sourceforge.net/manual/examples.html#native
  139. -keepclasseswithmembernames,includedescriptorclasses class * {
  140. native <methods>;
  141. }
  142. # Keep setters in Views so that animations can still work.
  143. -keepclassmembers public class * extends android.view.View {
  144. void set*(***);
  145. *** get*();
  146. }
  147. # We want to keep methods in Activity that could be used in the XML attribute onClick.
  148. -keepclassmembers class * extends android.app.Activity {
  149. public void *(android.view.View);
  150. }
  151. # For enumeration classes, see http://proguard.sourceforge.net/manual/examples.html#enumerations
  152. -keepclassmembers enum * {
  153. public static **[] values();
  154. public static ** valueOf(java.lang.String);
  155. }
  156. -keepclassmembers class * implements android.os.Parcelable {
  157. public static final ** CREATOR;
  158. }
  159. # Preserve annotated Javascript interface methods.
  160. -keepclassmembers class * {
  161. @android.webkit.JavascriptInterface <methods>;
  162. }
  163. # The support libraries contains references to newer platform versions.
  164. # Don't warn about those in case this app is linking against an older
  165. # platform version. We know about them, and they are safe.
  166. -dontnote android.support.**
  167. -dontnote androidx.**
  168. -dontwarn android.support.**
  169. -dontwarn androidx.**
  170. # This class is deprecated, but remains for backward compatibility.
  171. -dontwarn android.util.FloatMath
  172. # Understand the @Keep support annotation.
  173. -keep class android.support.annotation.Keep
  174. -keep class androidx.annotation.Keep
  175. -keep @android.support.annotation.Keep class * {*;}
  176. -keep @androidx.annotation.Keep class * {*;}
  177. -keepclasseswithmembers class * {
  178. @android.support.annotation.Keep <methods>;
  179. }
  180. -keepclasseswithmembers class * {
  181. @androidx.annotation.Keep <methods>;
  182. }
  183. -keepclasseswithmembers class * {
  184. @android.support.annotation.Keep <fields>;
  185. }
  186. -keepclasseswithmembers class * {
  187. @androidx.annotation.Keep <fields>;
  188. }
  189. -keepclasseswithmembers class * {
  190. @android.support.annotation.Keep <init>(...);
  191. }
  192. -keepclasseswithmembers class * {
  193. @androidx.annotation.Keep <init>(...);
  194. }
  195. # These classes are duplicated between android.jar and org.apache.http.legacy.jar.
  196. -dontnote org.apache.http.**
  197. -dontnote android.net.http.**
  198. # These classes are duplicated between android.jar and core-lambda-stubs.jar.
  199. -dontnote java.lang.invoke.**
  200. -dontwarn com.google.android.material.R$id