proguard-rules.pro 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  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. # 是否使用大小写混合
  22. -dontusemixedcaseclassnames
  23. # 是否混淆第三方jar
  24. -dontskipnonpubliclibraryclasses
  25. # 混淆时是否做预校验
  26. -dontpreverify
  27. # 混淆时是否记录日志
  28. -verbose
  29. # 混淆时所采用的算法
  30. -optimizations !code/simplification/arithmetic,!field/*,!class/merging/*
  31. -ignorewarnings
  32. #-ignorewarnings
  33. -keepattributes *Annotation*
  34. -keepattributes Signature
  35. -keepattributes SourceFile,LineNumberTable
  36. -keepattributes Exceptions,InnerClasses,Deprecated,LocalVariable*Table,Synthetic,EnclosingMethod
  37. -keepattributes EnclosingMethod
  38. # Keep native methods
  39. -keepclassmembers class * {
  40. native <methods>;
  41. }
  42. -keepclassmembers class * implements java.io.Serializable {
  43. static final long serialVersionUID;
  44. private static final java.io.ObjectStreamField[] serialPersistentFields;
  45. private void writeObject(java.io.ObjectOutputStream);
  46. private void readObject(java.io.ObjectInputStream);
  47. java.lang.Object writeReplace();
  48. java.lang.Object readResolve();
  49. }
  50. -keep public class * implements java.io.Serializable {
  51. public *;
  52. }
  53. -keep class **.R$*{
  54. *;
  55. }
  56. -keepclassmembers class * {
  57. public <init>(org.json.JSONObject);
  58. }
  59. -keepclasseswithmembernames class * {
  60. native <methods>;
  61. }
  62. -keepclassmembers enum * {
  63. public static **[] values();
  64. public static ** valueOf(java.lang.String);
  65. }
  66. # 对于带有回调函数的onXXEvent、**On*Listener的,不能被混淆
  67. -keepclassmembers class * {
  68. void *(**On*Event);
  69. void *(**On*Listener);
  70. }
  71. -keepattributes *JavascriptInterface*
  72. -keep class android.webkit.JavascriptInterface {*;}
  73. -keepclassmembers class * extends android.webkit.webViewClient {
  74. public void *(android.webkit.WebView, java.lang.String, android.graphics.Bitmap);
  75. public boolean *(android.webkit.WebView, java.lang.String);
  76. }
  77. -keepclassmembers class * extends android.webkit.webViewClient {
  78. public void *(android.webkit.webView, jav.lang.String);
  79. }
  80. -keep class com.hc.webapp.web.AndroidToJS {*;}
  81. -keep class com.hc.webapp.web.HCWebChromeClient {*;}
  82. -keep class com.hc.webapp.web.HCWebViewClient {*;}
  83. # ButterKnife
  84. -keep class butterknife.** { *; }
  85. -dontwarn butterknife.internal.**
  86. -keep class **$$ViewBinder { *; }
  87. -keepclasseswithmembernames class * {
  88. @butterknife.* <fields>;
  89. }
  90. -keepclasseswithmembernames class * {
  91. @butterknife.* <methods>;
  92. }
  93. # Glide
  94. -keep public class * implements com.bumptech.glide.module.GlideModule
  95. -keep public enum com.bumptech.glide.load.resource.bitmap.ImageHeaderParser$** {
  96. **[] $VALUES;
  97. public *;
  98. }
  99. # 保留我们自定义控件(继承自View)不被混淆
  100. -keep public class * extends android.view.View{
  101. *** get*();
  102. void set*(***);
  103. public <init>(android.content.Context);
  104. public <init>(android.content.Context, android.util.AttributeSet);
  105. public <init>(android.content.Context, android.util.AttributeSet, int);
  106. }
  107. -keep class com.shuyu.gsyvideoplayer.video.** { *; }
  108. -dontwarn com.shuyu.gsyvideoplayer.video.**
  109. -keep class com.shuyu.gsyvideoplayer.video.base.** { *; }
  110. -dontwarn com.shuyu.gsyvideoplayer.video.base.**
  111. -keep class com.shuyu.gsyvideoplayer.utils.** { *; }
  112. -dontwarn com.shuyu.gsyvideoplayer.utils.**
  113. -keep class tv.danmaku.ijk.** { *; }
  114. -dontwarn tv.danmaku.ijk.**