|
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 |
| - |
8 |
| -# If your project uses WebView with JS, uncomment the following |
9 |
| -# and specify the fully qualified class name to the JavaScript interface |
10 |
| -# class: |
11 |
| -#-keepclassmembers class fqcn.of.javascript.interface.for.webview { |
12 |
| -# public *; |
13 |
| -#} |
14 |
| - |
15 |
| -# Uncomment this to preserve the line number information for |
16 |
| -# debugging stack traces. |
17 |
| -#-keepattributes SourceFile,LineNumberTable |
18 |
| - |
19 |
| -# If you keep the line number information, uncomment this to |
20 |
| -# hide the original source file name. |
21 |
| -#-renamesourcefileattribute SourceFile |
| 1 | +#-------------------------------------------基本不用动区域-------------------------------------------- |
| 2 | +#---------------------------------基本指令区---------------------------------- |
| 3 | +-optimizationpasses 5 # 指定代码的压缩级别 |
| 4 | +-dontusemixedcaseclassnames # 是否使用大小写混合 |
| 5 | +-dontskipnonpubliclibraryclasses # 指定不去忽略非公共的库类 |
| 6 | +-dontskipnonpubliclibraryclassmembers # 指定不去忽略包可见的库类的成员 |
| 7 | +-dontpreverify # 混淆时是否做预校验 |
| 8 | +-verbose # 混淆时是否记录日志 |
| 9 | +-printmapping proguardMapping.txt |
| 10 | +-optimizations !code/simplification/cast,!field/*,!class/merging/* # 混淆时所采用的算法 |
| 11 | +-keepattributes *Annotation*,InnerClasses |
| 12 | +-keepattributes Signature |
| 13 | +-keepattributes SourceFile,LineNumberTable |
| 14 | +#---------------------------------------------------------------------------- |
| 15 | +-ignorewarnings # 是否忽略检测,(是) |
| 16 | +#---------------------------------默认保留区--------------------------------- |
| 17 | +-keep public class * extends android.app.Activity |
| 18 | +-keep public class * extends android.app.Application |
| 19 | +-keep public class * extends android.app.Service |
| 20 | +-keep public class * extends android.content.BroadcastReceiver |
| 21 | +-keep public class * extends android.content.ContentProvider |
| 22 | +-keep public class * extends android.app.backup.BackupAgentHelper |
| 23 | +-keep public class * extends android.preference.Preference |
| 24 | +-keep public class * extends android.view.View |
| 25 | +-keep public class com.android.vending.licensing.ILicensingService |
| 26 | +-keep class android.support.** {*;} |
| 27 | +#-ignorewarnings -keep class * { public private *; } |
| 28 | + |
| 29 | +#如果有引用v4包可以添加下面这行 |
| 30 | +-keep class android.support.v4.** { *; } |
| 31 | +-keep public class * extends android.support.v4.** |
| 32 | +-keep public class * extends android.app.Fragment |
| 33 | + |
| 34 | +-keepclasseswithmembernames class * { |
| 35 | + native <methods>; |
| 36 | +} |
| 37 | +-keepclassmembers class * extends android.app.Activity{ |
| 38 | + public void *(android.view.View); |
| 39 | +} |
| 40 | +-keepclassmembers enum * { |
| 41 | + public static **[] values(); |
| 42 | + public static ** valueOf(java.lang.String); |
| 43 | +} |
| 44 | +-keep public class * extends android.view.View{ |
| 45 | + *** get*(); |
| 46 | + void set*(***); |
| 47 | + public <init>(android.content.Context); |
| 48 | + public <init>(android.content.Context, android.util.AttributeSet); |
| 49 | + public <init>(android.content.Context, android.util.AttributeSet, int); |
| 50 | +} |
| 51 | +-keepclasseswithmembers class * { |
| 52 | + public <init>(android.content.Context, android.util.AttributeSet); |
| 53 | + public <init>(android.content.Context, android.util.AttributeSet, int); |
| 54 | +} |
| 55 | +-keep class * implements android.os.Parcelable { |
| 56 | + public static final android.os.Parcelable$Creator *; |
| 57 | +} |
| 58 | +-keepclassmembers class * implements java.io.Serializable { |
| 59 | + static final long serialVersionUID; |
| 60 | + private static final java.io.ObjectStreamField[] serialPersistentFields; |
| 61 | + private void writeObject(java.io.ObjectOutputStream); |
| 62 | + private void readObject(java.io.ObjectInputStream); |
| 63 | + java.lang.Object writeReplace(); |
| 64 | + java.lang.Object readResolve(); |
| 65 | +} |
| 66 | +#表示不混淆R文件中的所有静态字段 |
| 67 | +-keep class **.R$* { |
| 68 | + public static <fields>; |
| 69 | +} |
| 70 | +-keepclassmembers class * { |
| 71 | + void *(**On*Event); |
| 72 | +} |
| 73 | +#---------------------------------------------------------------------------- |
| 74 | + |
| 75 | +#---------------------------------webview------------------------------------ |
| 76 | +-keepclassmembers class fqcn.of.javascript.interface.for.Webview { |
| 77 | + public *; |
| 78 | +} |
| 79 | +-keepclassmembers class * extends android.webkit.WebViewClient { |
| 80 | + public void *(android.webkit.WebView, java.lang.String, android.graphics.Bitmap); |
| 81 | + public boolean *(android.webkit.WebView, java.lang.String); |
| 82 | +} |
| 83 | +-keepclassmembers class * extends android.webkit.WebViewClient { |
| 84 | + public void *(android.webkit.WebView, jav.lang.String); |
| 85 | +} |
| 86 | + |
| 87 | + |
| 88 | +#---------------------------------2.第三方库--------------------------------- |
| 89 | +#okhttp3 |
| 90 | +-dontwarn com.squareup.okhttp3.** |
| 91 | +-keep class com.squareup.okhttp3.** { *;} |
| 92 | +-keep class okhttp3.** { *;} |
| 93 | +-keep class okio.** { *;} |
| 94 | +-dontwarn sun.security.** |
| 95 | +-keep class sun.security.** { *;} |
| 96 | +-dontwarn okio.** |
| 97 | +-dontwarn okhttp3.** |
| 98 | + |
| 99 | +#retrofit2 |
| 100 | +-dontwarn retrofit2.** |
| 101 | +-keep class retrofit2.** { *; } |
| 102 | +-keepattributes Signature |
| 103 | +-keepattributes Exceptions |
| 104 | +-dontwarn org.robovm.** |
| 105 | +-keep class org.robovm.** { *; } |
| 106 | + |
| 107 | +# RxJava RxAndroid |
| 108 | +-dontwarn sun.misc.** |
| 109 | +-keepclassmembers class rx.internal.util.unsafe.*ArrayQueue*Field* { |
| 110 | + long producerIndex; |
| 111 | + long consumerIndex; |
| 112 | +} |
| 113 | +-keepclassmembers class rx.internal.util.unsafe.BaseLinkedQueueProducerNodeRef { |
| 114 | + rx.internal.util.atomic.LinkedQueueNode producerNode; |
| 115 | +} |
| 116 | +-keepclassmembers class rx.internal.util.unsafe.BaseLinkedQueueConsumerNodeRef { |
| 117 | + rx.internal.util.atomic.LinkedQueueNode consumerNode; |
| 118 | +} |
| 119 | +-dontnote rx.internal.util.PlatformDependent |
| 120 | + |
| 121 | +# Retrofit, OkHttp, Gson |
| 122 | +-keep class com.squareup.okhttp.** { *; } |
| 123 | +-keep interface com.squareup.okhttp.** { *; } |
| 124 | +-dontwarn com.squareup.okhttp.** |
| 125 | +-dontwarn rx.** |
| 126 | +-dontwarn retrofit.** |
| 127 | +-keep class retrofit.** { *; } |
| 128 | +-keepclasseswithmembers class * { |
| 129 | + @retrofit.http.* <methods>; |
| 130 | +} |
| 131 | +-keep class sun.misc.Unsafe { *; } |
| 132 | +-dontwarn java.nio.file.* |
| 133 | +-dontwarn org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement |
| 134 | + |
| 135 | +# Rxjava-promises |
| 136 | +-keep class com.darylteo.rx.** { *; } |
| 137 | +-dontwarn com.darylteo.rx.** |
| 138 | + |
| 139 | +# RxJava 0.21 |
| 140 | +-keep class rx.schedulers.Schedulers { |
| 141 | + public static <methods>; |
| 142 | +} |
| 143 | +-keep class rx.schedulers.ImmediateScheduler { |
| 144 | + public <methods>; |
| 145 | +} |
| 146 | +-keep class rx.schedulers.TestScheduler { |
| 147 | + public <methods>; |
| 148 | +} |
| 149 | +-keep class rx.schedulers.Schedulers { |
| 150 | + public static ** test(); |
| 151 | +} |
| 152 | + |
| 153 | +#butterknife |
| 154 | +-keep class butterknife.** { *; } |
| 155 | +-dontwarn butterknife.internal.** |
| 156 | +-keep class **$$ViewBinder { *; } |
| 157 | +-keepclasseswithmembernames class * { |
| 158 | + @butterknife.* <fields>; |
| 159 | +} |
| 160 | +-keepclasseswithmembernames class * { |
| 161 | + @butterknife.* <methods>; |
| 162 | +} |
| 163 | + |
| 164 | +# RxLifeCycle2 |
| 165 | +-keep class com.trello.rxlifecycle2.** { *; } |
| 166 | +-keep interface com.trello.rxlifecycle2.** { *; } |
| 167 | +-dontwarn com.trello.rxlifecycle2.** |
| 168 | + |
| 169 | +-keep class com.github.mikephil.charting.** { *; } |
| 170 | +-dontwarn com.github.mikephil.charting.data.realm.** |
| 171 | + |
| 172 | + |
| 173 | +#Glide |
| 174 | +-keep public class * implements com.bumptech.glide.module.GlideModule |
| 175 | +-keep public class * extends com.bumptech.glide.module.AppGlideModule |
| 176 | +-keep public enum com.bumptech.glide.load.ImageHeaderParser$** { |
| 177 | + **[] $VALUES; |
| 178 | + public *; |
| 179 | +} |
| 180 | +# for DexGuard only |
| 181 | +#-keepresourcexmlelements manifest/application/meta-data@value=GlideModule |
| 182 | + |
| 183 | +#ARouter |
| 184 | +-keep public class com.alibaba.android.arouter.routes.**{*;} |
| 185 | +-keep public class com.alibaba.android.arouter.facade.**{*;} |
| 186 | +-keep class * implements com.alibaba.android.arouter.facade.template.ISyringe{*;} |
| 187 | +# If you use the byType method to obtain Service, add the following rules to protect the interface: |
| 188 | +-keep interface * implements com.alibaba.android.arouter.facade.template.IProvider |
| 189 | +# If single-type injection is used, that is, no interface is defined to implement IProvider, the following rules need to be added to protect the implementation |
| 190 | +#-keep class * implements com.alibaba.android.arouter.facade.template.IProvider |
| 191 | + |
| 192 | + |
0 commit comments