|
1 | 1 | # Add project specific ProGuard rules here. |
2 | | -# By default, the flags in this file are appended to flags specified |
3 | | -# in D:\SDK/tools/proguard/proguard-android.txt |
4 | | -# You can edit the include path and order by changing the proguardFiles |
5 | | -# directive in build.gradle. |
6 | | -# |
7 | | -# For more details, see |
8 | | -# http://developer.android.com/guide/developing/tools/proguard.html |
9 | | - |
10 | | -# Add any project specific keep options here: |
11 | | - |
12 | | -# If your project uses WebView with JS, uncomment the following |
13 | | -# and specify the fully qualified class name to the JavaScript interface |
14 | | -# class: |
15 | | -#-keepclassmembers class fqcn.of.javascript.interface.for.webview { |
16 | | -# public *; |
17 | | -#} |
| 2 | + # By default, the flags in this file are appended to flags specified |
| 3 | + # in D:\SDK/tools/proguard/proguard-android.txt |
| 4 | + # You can edit the include path and order by changing the proguardFiles |
| 5 | + # directive in build.gradle. |
| 6 | + # |
| 7 | + # For more details, see |
| 8 | + # http://developer.android.com/guide/developing/tools/proguard.html |
| 9 | + |
| 10 | + # Add any project specific keep options here: |
| 11 | + |
| 12 | + # If your project uses WebView with JS, uncomment the following |
| 13 | + # and specify the fully qualified class name to the JavaScript interface |
| 14 | + # class: |
| 15 | + #-keepclassmembers class fqcn.of.javascript.interface.for.webview { |
| 16 | + # public *; |
| 17 | + #} |
| 18 | + #---------------------------------基本指令区---------------------------------- |
| 19 | + -ignorewarnings |
| 20 | + -dontusemixedcaseclassnames # 是否使用大小写混合 |
| 21 | + -dontpreverify # 混淆时是否做预校验 |
| 22 | + -verbose # 混淆时是否记录日志 |
| 23 | + -printmapping proguardMapping.txt |
| 24 | + -optimizationpasses 5 # 指定代码的压缩级别 |
| 25 | + -dontskipnonpubliclibraryclassmembers |
| 26 | + |
| 27 | + |
| 28 | + -optimizations !code/simplification/arithmetic,!field/*,!class/merging/* |
| 29 | + -keepattributes *Annotation*,InnerClasses |
| 30 | + -keepattributes Signature # 避免混淆泛型 |
| 31 | + -keepattributes EnclosingMethod |
| 32 | + -keepattributes SourceFile,LineNumberTable #运行抛出异常时保留代码行号 |
| 33 | + -keepattributes Exceptions # 解决AGPBI警告 |
| 34 | + |
| 35 | + #继承自activity,application,service,broadcastReceiver,contentprovider....不进行混淆 |
| 36 | + -keep public class * extends android.app.Activity |
| 37 | + -keep public class * extends android.app.Application |
| 38 | + -keep public class * extends android.support.multidex.MultiDexApplication |
| 39 | + -keep public class * extends android.app.Service |
| 40 | + -keep public class * extends android.content.BroadcastReceiver |
| 41 | + -keep public class * extends android.content.ContentProvider |
| 42 | + -keep public class * extends android.app.backup.BackupAgentHelper |
| 43 | + -keep public class * extends android.preference.Preference |
| 44 | + -keep public class * extends android.view.View |
| 45 | + -keep public class com.android.vending.licensing.ILicensingService |
| 46 | + -keep class android.support.** {*;} |
| 47 | + |
| 48 | + # 所有View的子类及其子类的get、set方法都不进行混淆 |
| 49 | + -keep public class * extends android.view.View{ |
| 50 | + *** get*(); |
| 51 | + void set*(***); |
| 52 | + public <init>(android.content.Context); |
| 53 | + public <init>(android.content.Context, android.util.AttributeSet); |
| 54 | + public <init>(android.content.Context, android.util.AttributeSet, int); |
| 55 | + } |
| 56 | + |
| 57 | + -keepclasseswithmembers class * { |
| 58 | + public <init>(android.content.Context, android.util.AttributeSet); |
| 59 | + public <init>(android.content.Context, android.util.AttributeSet, int); |
| 60 | + } |
| 61 | + |
| 62 | + # 这个主要是在layout 中写的onclick方法android:onclick="onClick",不进行混淆 |
| 63 | + -keepclassmembers class * extends android.app.Activity { |
| 64 | + public void *(android.view.View); |
| 65 | + } |
| 66 | + |
| 67 | + |
| 68 | + # 对于带有回调函数onXXEvent的,不能被混淆 |
| 69 | + -keepclassmembers class * { |
| 70 | + void *(*Event); |
| 71 | + } |
| 72 | + |
| 73 | + # 枚举类不能被混淆 |
| 74 | + -keepclassmembers enum * { |
| 75 | + public static **[] values(); |
| 76 | + public static ** valueOf(java.lang.String); |
| 77 | + } |
| 78 | + |
| 79 | + # natvie 方法不混淆 |
| 80 | + -keepclasseswithmembernames class * { |
| 81 | + native <methods>; |
| 82 | + } |
| 83 | + #litepal数据库不能被混淆 |
| 84 | + -keep class org.litepal.** { |
| 85 | + *; |
| 86 | + } |
| 87 | + -keep class * extends org.litepal.crud.DataSupport { |
| 88 | + *; |
| 89 | + } |
| 90 | + |
| 91 | + #Glide不能被混淆 |
| 92 | + -keep public class * implements com.bumptech.glide.module.GlideModule |
| 93 | + -keep public enum com.bumptech.glide.load.resource.bitmap.ImageHeaderParser$** { |
| 94 | + **[] $VALUES; |
| 95 | + public *; |
| 96 | + } |
| 97 | + |
| 98 | + # 保持 Parcelable 不被混淆 |
| 99 | + -keep class * implements android.os.Parcelable { |
| 100 | + public static final android.os.Parcelable$Creator *; |
| 101 | + } |
| 102 | + |
| 103 | + #不混淆Serializable接口的子类中指定的某些成员变量和方法 |
| 104 | + -keepclassmembers class * implements java.io.Serializable { |
| 105 | + static final long serialVersionUID; |
| 106 | + private static final java.io.ObjectStreamField[] serialPersistentFields; |
| 107 | + private void writeObject(java.io.ObjectOutputStream); |
| 108 | + private void readObject(java.io.ObjectInputStream); |
| 109 | + java.lang.Object writeReplace(); |
| 110 | + java.lang.Object readResolve(); |
| 111 | + } |
| 112 | + |
| 113 | + # 不混淆R类里及其所有内部static类中的所有static变量字段 |
| 114 | + -keep public class com.guiying.androidmodulepattern.R$*{ |
| 115 | + public static final int *; |
| 116 | + } |
| 117 | + |
| 118 | + # $是用来分割内嵌类与其母体的标志 |
| 119 | + -keep class **.R$* { |
| 120 | + *; |
| 121 | + } |
| 122 | + |
| 123 | + |
| 124 | + -keepclassmembers class * { |
| 125 | + public <init> (org.json.JSONObject); |
| 126 | + } |
| 127 | + |
| 128 | + #---------------------------------webview------------------------------------ |
| 129 | + -keepclassmembers class fqcn.of.javascript.interface.for.webview { |
| 130 | + public *; |
| 131 | + } |
| 132 | + -keepclassmembers class * extends android.webkit.webViewClient { |
| 133 | + public void *(android.webkit.WebView, java.lang.String, android.graphics.Bitmap); |
| 134 | + public boolean *(android.webkit.WebView, java.lang.String); |
| 135 | + } |
| 136 | + |
| 137 | +#---------------------------------实体类--------------------------------- |
| 138 | + |
| 139 | + |
| 140 | + |
| 141 | + #---------------------------------第三方包------------------------------- |
| 142 | +#activityrouter |
| 143 | +-keep class com.github.mzule.activityrouter.router.** { *; } |
| 144 | + |
| 145 | + #友盟统计 |
| 146 | + -keep class com.umeng.analytics.** {*;} |
| 147 | + -dontwarn com.umeng.analytics.** |
| 148 | + |
| 149 | + |
| 150 | + #换肤框架的混淆文件 |
| 151 | + -keep class solid.ren.skinlibrary.** {*;} |
| 152 | + -dontwarn solid.ren.skinlibrary.** |
| 153 | + |
| 154 | + #高德相关混淆文件 |
| 155 | + #3D 地图 |
| 156 | + -keep class com.amap.api.** {*;} |
| 157 | + -keep class com.autonavi.** {*;} |
| 158 | + -keep class com.a.a.** {*;} |
| 159 | + -keep class com.loc.** {*;} |
| 160 | + -dontwarn com.amap.api.** |
| 161 | + -dontwarn com.autonavi.** |
| 162 | + -dontwarn com.a.a.** |
| 163 | + -dontwarn com.loc.** |
| 164 | + |
| 165 | + |
| 166 | + # simple-xml-core的SDK |
| 167 | + -keep class org.simpleframework.xml.** {*;} |
| 168 | + -dontwarn org.simpleframework.xml.** |
| 169 | + |
| 170 | + # acra的 SDK |
| 171 | + -keep class org.acra.** {*;} |
| 172 | + -dontwarn org.acra.** |
| 173 | + |
| 174 | + # 网络请求库async-http |
| 175 | + -keep class com.loopj.android.http.** {*;} |
| 176 | + -dontwarn com.loopj.android.http.** |
| 177 | + |
| 178 | + |
| 179 | + #pinyin4j |
| 180 | + -dontwarn net.soureceforge.pinyin4j.** |
| 181 | + -dontwarn demo.** |
| 182 | + -keep class net.sourceforge.pinyin4j.** { *;} |
| 183 | + -keep class demo.** { *;} |
| 184 | + -keep class com.hp.** { *;} |
| 185 | + |
| 186 | + #httpclient (org.apache.http.legacy.jar) |
| 187 | + -dontwarn android.net.compatibility.** |
| 188 | + -dontwarn android.net.http.** |
| 189 | + -dontwarn com.android.internal.http.multipart.** |
| 190 | + -dontwarn org.apache.commons.** |
| 191 | + -dontwarn org.apache.http.** |
| 192 | + -dontwarn org.apache.http.protocol.** |
| 193 | + -keep class android.net.compatibility.**{*;} |
| 194 | + -keep class android.net.http.**{*;} |
| 195 | + -keep class com.android.internal.http.multipart.**{*;} |
| 196 | + -keep class org.apache.commons.**{*;} |
| 197 | + -keep class org.apache.org.**{*;} |
| 198 | + -keep class org.apache.harmony.**{*;} |
| 199 | + |
| 200 | + #图表库 |
| 201 | + -keep class com.github.mikephil.charting.** {*;} |
| 202 | + -dontwarn com.github.mikephil.charting.** |
| 203 | + |
| 204 | + # 讯飞语音 |
| 205 | + -keep class com.chinaMobile.** {*;} |
| 206 | + -keep class com.iflytek.** {*;} |
| 207 | + -keep class com.iflytek.sunflower.** {*;} |
| 208 | + -dontwarn com.iflytek.sunflower.** |
| 209 | + -dontwarn com.chinaMobile.** |
| 210 | + -dontwarn com.iflytek.** |
| 211 | + |
| 212 | + # greenDao混淆 |
| 213 | + -keep class de.greenrobot.dao.** {*;} |
| 214 | + -keepclassmembers class * extends de.greenrobot.dao.AbstractDao { |
| 215 | + public static Java.lang.String TABLENAME; |
| 216 | + } |
| 217 | + -keep class **$Properties |
| 218 | + |
| 219 | + # gson |
| 220 | + -keep class com.google.gson.** {*;} |
| 221 | + -keep class com.google.**{*;} |
| 222 | + -keep class sun.misc.Unsafe { *; } |
| 223 | + -keep class com.google.gson.stream.** { *; } |
| 224 | + -keep class com.google.gson.examples.android.model.** { *; } |
| 225 | + |
| 226 | + # zxing |
| 227 | + -keep class com.google.zxing.** {*;} |
| 228 | + -dontwarn com.google.zxing.** |
| 229 | + |
| 230 | + ##百度定位 |
| 231 | + -keep class com.baidu.** {*;} |
| 232 | + -keep class vi.com.** {*;} |
| 233 | + -dontwarn com.baidu.** |
| 234 | + |
| 235 | + ## okhttp |
| 236 | + -dontwarn com.squareup.okhttp.** |
| 237 | + -keep class com.squareup.okhttp.{*;} |
| 238 | + |
| 239 | + #okhttp3.x |
| 240 | + -dontwarn com.squareup.okhttp3.** |
| 241 | + -keep class com.squareup.okhttp3.** { *;} |
| 242 | + -dontwarn okio.** |
| 243 | + |
| 244 | + #retrofit |
| 245 | + -dontwarn retrofit.** |
| 246 | + -keep class retrofit.** { *; } |
| 247 | + -keepattributes Signature |
| 248 | + -keepattributes Exceptions |
| 249 | + -dontwarn okio.** |
| 250 | + |
| 251 | + |
| 252 | + #recyclerview-animators |
| 253 | + -keep class jp.wasabeef.** {*;} |
| 254 | + -dontwarn jp.wasabeef.* |
| 255 | + |
| 256 | + #multistateview |
| 257 | + -keep class com.kennyc.view.** { *; } |
| 258 | + -dontwarn com.kennyc.view.* |
| 259 | + |
| 260 | + # universal-image-loader 混淆 |
| 261 | + -dontwarn com.nostra13.universalimageloader.** |
| 262 | + -keep class com.nostra13.universalimageloader.** { *; } |
| 263 | + |
| 264 | + |
| 265 | + #-ButterKnife 7.0 |
| 266 | + -keep class butterknife.** { *; } |
| 267 | + -dontwarn butterknife.internal.** |
| 268 | + -keep class **$$ViewBinder { *; } |
| 269 | + -keepclasseswithmembernames class * { |
| 270 | + @butterknife.* <fields>; |
| 271 | + } |
| 272 | + -keepclasseswithmembernames class * { |
| 273 | + @butterknife.* <methods>; |
| 274 | + } |
| 275 | + |
| 276 | + #eventbus 3.0 |
| 277 | + -keepattributes *Annotation* |
| 278 | + -keepclassmembers class ** { |
| 279 | + @org.greenrobot.eventbus.Subscribe <methods>; |
| 280 | + } |
| 281 | + -keep enum org.greenrobot.eventbus.ThreadMode { *; } |
| 282 | + -keepclassmembers class * extends org.greenrobot.eventbus.util.ThrowableFailureEvent { |
| 283 | + <init>(java.lang.Throwable); |
| 284 | + } |
| 285 | + |
| 286 | + #EventBus |
| 287 | + -keepclassmembers class ** { |
| 288 | + public void onEvent*(**); |
| 289 | + } |
| 290 | + -keepclassmembers class ** { |
| 291 | + public void xxxxxx(**); |
| 292 | + } |
| 293 | + |
| 294 | + # support-v4 |
| 295 | + -dontwarn android.support.v4.** |
| 296 | + -keep class android.support.v4.app.** { *; } |
| 297 | + -keep interface android.support.v4.app.** { *; } |
| 298 | + -keep class android.support.v4.** { *; } |
| 299 | + |
| 300 | + |
| 301 | + # support-v7 |
| 302 | + -dontwarn android.support.v7.** |
| 303 | + -keep class android.support.v7.internal.** { *; } |
| 304 | + -keep interface android.support.v7.internal.** { *; } |
| 305 | + -keep class android.support.v7.** { *; } |
| 306 | + |
| 307 | + # support design |
| 308 | + -dontwarn android.support.design.** |
| 309 | + -keep class android.support.design.** { *; } |
| 310 | + -keep interface android.support.design.** { *; } |
| 311 | + -keep public class android.support.design.R$* { *; } |
0 commit comments