Skip to content

Commit ad4cd08

Browse files
author
Ttt
committed
1.增加混淆注解忽略、以及部分变量 @keep
Former-commit-id: de14ccd
1 parent f3ed6a0 commit ad4cd08

File tree

6 files changed

+46
-0
lines changed

6 files changed

+46
-0
lines changed

DevLibUtils/proguard-rules.pro

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,22 @@
1919
# If you keep the line number information, uncomment this to
2020
# hide the original source file name.
2121
#-renamesourcefileattribute SourceFile
22+
23+
-dontwarn android.support.**
24+
25+
# Understand the @Keep support annotation.
26+
-keep class android.support.annotation.Keep
27+
28+
-keep @android.support.annotation.Keep class * {*;}
29+
30+
-keepclasseswithmembers class * {
31+
@android.support.annotation.Keep <methods>;
32+
}
33+
34+
-keepclasseswithmembers class * {
35+
@android.support.annotation.Keep <fields>;
36+
}
37+
38+
-keepclasseswithmembers class * {
39+
@android.support.annotation.Keep <init>(...);
40+
}

DevLibUtils/src/main/java/dev/utils/app/info/ApkInfoItem.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import android.content.pm.PackageInfo;
66
import android.content.pm.PackageManager;
77
import android.content.pm.Signature;
8+
import android.support.annotation.Keep;
89
import android.text.TextUtils;
910
import android.text.format.Formatter;
1011

@@ -32,10 +33,13 @@ public final class ApkInfoItem {
3233
// 日志Tag
3334
private static final String TAG = ApkInfoItem.class.getSimpleName();
3435
// Apk 文件地址
36+
@Keep
3537
private String apkUri;
3638
// App 信息实体类
39+
@Keep
3740
private AppInfoBean appInfoBean;
3841
// App 参数集
42+
@Keep
3943
private List<KeyValueBean> listKeyValues = new ArrayList<>();
4044

4145
private ApkInfoItem(){

DevLibUtils/src/main/java/dev/utils/app/info/AppInfoBean.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import android.content.pm.PackageInfo;
55
import android.content.pm.PackageManager;
66
import android.graphics.drawable.Drawable;
7+
import android.support.annotation.Keep;
78

89
import dev.DevUtils;
910
import dev.utils.LogPrintUtils;
@@ -20,26 +21,37 @@ public class AppInfoBean {
2021
// 日志Tag
2122
private static final String TAG = AppInfoBean.class.getSimpleName();
2223
// App 包名
24+
@Keep
2325
private String appPackName;
2426
// App 名
27+
@Keep
2528
private String appName;
2629
// App 图标
30+
@Keep
2731
private transient Drawable appIcon;
2832
// App 类型
33+
@Keep
2934
private AppType appType;
3035
// 获取版本号
36+
@Keep
3137
private int versionCode;
3238
// 获取版本名
39+
@Keep
3340
private String versionName;
3441
// App 首次安装时间
42+
@Keep
3543
private long firstInstallTime;
3644
// 获取最后一次更新时间
45+
@Keep
3746
private long lastUpdateTime;
3847
// 获取 App 地址
48+
@Keep
3949
private String sourceDir;
4050
// Apk 大小
51+
@Keep
4152
private long apkSize;
4253
// 申请的权限
54+
@Keep
4355
private String [] apkPermissionsArys;
4456

4557
/**

DevLibUtils/src/main/java/dev/utils/app/info/AppInfoItem.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import android.content.Context;
44
import android.content.pm.PackageInfo;
55
import android.content.pm.PackageManager;
6+
import android.support.annotation.Keep;
67
import android.text.TextUtils;
78
import android.text.format.Formatter;
89

@@ -26,8 +27,10 @@
2627
public final class AppInfoItem {
2728

2829
// App 信息实体类
30+
@Keep
2931
private AppInfoBean appInfoBean;
3032
// App 参数集
33+
@Keep
3134
private List<KeyValueBean> listKeyValues = new ArrayList<>();
3235

3336
private AppInfoItem(){

DevLibUtils/src/main/java/dev/utils/app/info/KeyValueBean.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package dev.utils.app.info;
22

3+
import android.support.annotation.Keep;
34
import android.support.annotation.StringRes;
45

56
import dev.DevUtils;
@@ -11,8 +12,10 @@
1112
public class KeyValueBean {
1213

1314
// 键 - 提示
15+
@Keep
1416
protected String key = "";
1517
// 值 - 参数值
18+
@Keep
1619
protected String value = "";
1720

1821
/**

DevLibUtils/src/main/java/dev/utils/app/wifi/WifiVo.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import android.net.wifi.ScanResult;
44
import android.os.Parcel;
55
import android.os.Parcelable;
6+
import android.support.annotation.Keep;
67

78
import java.util.ArrayList;
89
import java.util.List;
@@ -18,12 +19,16 @@ public class WifiVo implements Parcelable {
1819
// 日志TAG
1920
private static final String TAG = WifiVo.class.getSimpleName();
2021
/** wifi SSID */
22+
@Keep
2123
public String wSSID = null;
2224
/** wifi 密码 */
25+
@Keep
2326
public String wPwd = null;
2427
/** wifi 加密类型 */
28+
@Keep
2529
public int wType = WifiUtils.NOPWD;
2630
/** wifi 信号等级 */
31+
@Keep
2732
public int wLevel = 0;
2833

2934
// --

0 commit comments

Comments
 (0)