proguard-rules.pro 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208
  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. # 代码混淆压缩比,在0~7之间,默认为5,一般不做修改
  20. -optimizationpasses 5
  21. # 混合时不使用大小写混合,混合后的类名为小写
  22. -dontusemixedcaseclassnames
  23. # 指定不去忽略非公共库的类
  24. -dontskipnonpubliclibraryclasses
  25. # 指定不去忽略非公共库的类成员
  26. -dontskipnonpubliclibraryclassmembers
  27. # 这句话能够使我们的项目混淆后产生映射文件
  28. # 包含有类名->混淆后类名的映射关系
  29. -verbose
  30. # 不做预校验,preverify是proguard的四个步骤之一,Android不需要preverify,去掉这一步能够加快混淆速度。
  31. -dontpreverify
  32. # 保留Annotation不混淆 这在JSON实体映射时非常重要,比如fastJson
  33. -keepattributes *Annotation*,InnerClasses
  34. # 避免混淆泛型
  35. -keepattributes Signature
  36. # 抛出异常时保留代码行号
  37. -keepattributes SourceFile,LineNumberTable
  38. # 指定混淆是采用的算法,后面的参数是一个过滤器
  39. # 这个过滤器是谷歌推荐的算法,一般不做更改
  40. -optimizations !code/simplification/cast,!field/*,!class/merging/*
  41. # 忽略警告
  42. -ignorewarnings
  43. # 设置是否允许改变作用域
  44. -allowaccessmodification
  45. # 把混淆类中的方法名也混淆了
  46. -useuniqueclassmembernames
  47. # apk 包内所有 class 的内部结构
  48. -dump class_files.txt
  49. # 未混淆的类和成员
  50. -printseeds seeds_txt
  51. # 列出从apk中删除的代码
  52. -printusage unused.txt
  53. # 混淆前后的映射
  54. -printmapping mapping.txt
  55. -keep public class * extends android.app.Activity
  56. -keep public class * extends android.app.Application
  57. -keep public class * extends android.app.Service
  58. -keep public class * extends android.content.BroadcastReceiver
  59. -keep public class * extends android.content.ContentProvider
  60. -keep public class * extends android.app.backup.BackupAgent
  61. -keep public class * extends android.preference.Preference
  62. -keep public class * extends android.support.v4.app.Fragment
  63. -keep public class * extends android.app.Fragment
  64. -keep public class * extends android.view.view
  65. -keep public class com.android.vending.licensing.ILicensingService
  66. -keep public class * extends android.support.v4.**{
  67. <fields>;
  68. <methods>;
  69. }
  70. -keep public class * extends android.support.v7.**
  71. -keep public class * extends android.support.annotation.**
  72. -keepattributes *Annotation*
  73. -keepattributes *JavascriptInterface*
  74. -keep class * implements android.os.Parcelable {
  75. public static final android.os.Parcelable$Creator *;
  76. }
  77. -keep class * implements java.io.Serializable {
  78. public *;
  79. }
  80. -keepclassmembers class * implements java.io.Serializable {
  81. static final long serialVersionUID;
  82. private static final java.io.ObjectStreamField[] serialPersistentFields;
  83. !static !transient <fields>;
  84. private void writeObject(java.io.ObjectOutputStream);
  85. private void readObject(java.io.ObjectInputStream);
  86. java.lang.Object writeReplace();
  87. java.lang.Object readResolve();
  88. }
  89. -keep class com.google.gson.** {*;}
  90. -keep class sun.misc.Unsafe {*;}
  91. -keep class com.google.gson.stream.** {*;}
  92. -keep class com.google.gson.examples.android.model.** {*;}
  93. -keep class com.google.** {
  94. <fields>;
  95. <methods>;
  96. }
  97. #保持自定义控件类不被混淆
  98. -keepclasseswithmembers class * {
  99. public <init>(android.content.Context, android.util.AttributeSet);
  100. }
  101. #保持自定义控件类不被混淆
  102. -keepclassmembers class * extends android.app.Activity {
  103. public void *(android.view.View);
  104. }
  105. -keep public class * extends android.view.View {
  106. public <init>(android.content.Context);
  107. public <init>(android.content.Context, android.util.AttributeSet);
  108. public <init>(android.content.Context, android.util.AttributeSet, int);
  109. public void set*(...);
  110. }
  111. #butterknife
  112. -keep class butterknife.** { *; }
  113. -dontwarn butterknife.internal.**
  114. -keep class **$$ViewBinder { *; }
  115. -keep class **$$ViewIjector { *; }
  116. -keepclasseswithmembernames class * {
  117. @butterknife.* <fields>;
  118. }
  119. -keepclasseswithmembernames class * {
  120. @butterknife.* <methods>;
  121. }
  122. #butterknife
  123. #iot-check
  124. -keep class com.bgy.iot.** { *; }
  125. -keep class io.netty.** { *; }
  126. #iot-check
  127. #打印机的
  128. -keep class com.printsdk.**{*;}
  129. -keep class android.net.http.SslError
  130. -keep class android.webkit.**{*;}
  131. -keep class cn.sharesdk.**{*;}
  132. -keep class com.sina.**{*;}
  133. -keep class m.framework.**{*;}
  134. -keep class **.R$* {*;}
  135. -keep class **.R{*;}
  136. -dontwarn cn.sharesdk.**
  137. -dontwarn **.R$*
  138. -keep class * extends com.bgy.autosale.base.ui.BaseFragment
  139. -keep class * extends com.bgy.autosale.base.ui.BaseAutoExitFragment
  140. -keep class * extends com.bgy.autosale.base.ui.BaseActivity
  141. -keep class * implements com.bgy.autosale.interfaces.FlavorInterface {
  142. public *;
  143. }
  144. ### greenDAO 3
  145. -keep class org.greenrobot.greendao.**{*;}
  146. -keep public class * extends org.greenrobot.greendao.AbstractDao
  147. -keepclassmembers class * extends org.greenrobot.greendao.AbstractDao {
  148. public static java.lang.String TABLENAME;
  149. public *;
  150. }
  151. -keep class **$Properties
  152. -keepclassmembers class **$Properties {*;}
  153. # 如果类中有使用了注解的字段,则不混淆类和类成员
  154. -keepclasseswithmembers class * {
  155. @com.bgy.autosale.socket.base.ServerMethod <methods>;
  156. }
  157. # 如果类中有使用了注解的字段,则不混淆类和类成员
  158. -keepclasseswithmembers class * {
  159. @com.bgy.autosale.socket.base.ServerApi <methods>;
  160. }
  161. # 如果类中有使用了注解的字段,则不混淆类和类成员
  162. -keepclasseswithmembers class * {
  163. @com.bgy.plc.proxys.base.ProxyMethod <methods>;
  164. }
  165. # 如果类中有使用了注解的字段,则不混淆类和类成员
  166. -keepclasseswithmembers class * {
  167. @com.bgy.plc.proxys.base.ProxySendApi <methods>;
  168. }