Skip to content

Commit effa438

Browse files
committed
support proguard config
1 parent ebbbaf0 commit effa438

8 files changed

Lines changed: 26 additions & 190 deletions

File tree

README.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -422,6 +422,20 @@ class CustomActivity:BaseMVPActivity, CustomView {
422422
}
423423
```
424424

425+
## 混淆配置
426+
427+
部分组件需要进行混淆配置。请注意别遗漏了:
428+
429+
```
430+
# EasyBundle
431+
-keepclasseswithmembernames class * {
432+
@com.haoge.easyandroid.easy.BundleField <fields>;
433+
}
434+
435+
# EasySharedPreferences
436+
-keep class * implements com.haoge.easyandroid.easy.PreferenceSupport { *; }
437+
```
438+
425439
## 联系作者
426440

427441
<a target="_blank" href="http://shang.qq.com/wpa/qunwpa?idkey=99e758d20823a18049a06131b6d1b2722878720a437b4690e238bce43aceb5e1"><img border="0" src="http://pub.idqqimg.com/wpa/images/group.png" alt="安卓交流会所" title="安卓交流会所"></a>

app/build.gradle

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,10 @@ android {
1111
targetSdkVersion 27
1212
versionCode 1
1313
versionName "1.0"
14-
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
1514
}
1615
buildTypes {
1716
release {
18-
minifyEnabled false
17+
minifyEnabled true
1918
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
2019
}
2120
}
@@ -24,7 +23,6 @@ android {
2423
def butterknife_version = '8.8.1'
2524
dependencies {
2625
implementation "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
27-
implementation 'junit:junit:4.12'
2826
implementation 'com.android.support:appcompat-v7:27.1.1'
2927

3028
implementation 'com.alibaba:fastjson:1.1.68.android'

app/proguard-rules.pro

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,11 @@
1919
# If you keep the line number information, uncomment this to
2020
# hide the original source file name.
2121
#-renamesourcefileattribute SourceFile
22+
23+
# EasyBundle
24+
-keepclasseswithmembernames class * {
25+
@com.haoge.easyandroid.easy.BundleField <fields>;
26+
}
27+
28+
# EasySharedPreferences
29+
-keep class * implements com.haoge.easyandroid.easy.PreferenceSupport { *; }

keys

2.17 KB
Binary file not shown.

utils/build.gradle

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,6 @@ android {
2222
}
2323

2424
dependencies {
25-
testImplementation 'junit:junit:4.12'
26-
2725
implementation "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
2826

2927
compileOnly 'com.alibaba:fastjson:1.2.47'

utils/src/main/java/com/haoge/easyandroid/easy/EasyLog.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ class EasyLog private constructor(
141141
private fun dispatchToLogPrinterThread(invoke:(Thread, StackTraceElement, String) -> Unit) {
142142
val trace = findTrace()
143143
val current = Thread.currentThread()
144-
val tag = if (tag.isEmpty()) trace.fileName else tag
144+
val tag = if (tag.isEmpty()) trace.fileName?:trace.className?:"unknown tag" else tag
145145
this.tag = ""
146146
if (immediate) {
147147
invoke.invoke(current, trace, tag)
@@ -288,8 +288,8 @@ class EasyLog private constructor(
288288

289289
private val rules:MutableMap<String, (StackTraceElement, Thread)->String> = mutableMapOf(
290290
Pair("#T", { _, thread -> "[${thread.name}]"}),
291-
Pair("#F", { trace, _ -> "${trace.className.substringAfterLast('.')}.${trace.methodName}(${trace.fileName}:${trace.lineNumber})"}),
292-
Pair("#f", { trace, _ -> "(${trace.fileName}:${trace.lineNumber})"})
291+
Pair("#F", { trace, _ -> "${trace.className.substringAfterLast('.')}.${trace.methodName}(${trace.fileName?:"unknown"}:${trace.lineNumber})"}),
292+
Pair("#f", { trace, _ -> "(${trace.fileName?:"unknown"}:${trace.lineNumber})"})
293293
)
294294

295295
/**

utils/src/test/java/com/haoge/easyandroid/easy/EasyReflectTest.java

Lines changed: 0 additions & 151 deletions
This file was deleted.

utils/src/test/java/com/haoge/easyandroid/easy/EasyReflectWithKt.kt

Lines changed: 0 additions & 31 deletions
This file was deleted.

0 commit comments

Comments
 (0)