proguard-rules.pro 8.7 KB

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