Skip to content

Commit

Permalink
support proguard config
Browse files Browse the repository at this point in the history
  • Loading branch information
yjfnypeu committed Oct 9, 2018
1 parent ebbbaf0 commit effa438
Show file tree
Hide file tree
Showing 8 changed files with 26 additions and 190 deletions.
14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -422,6 +422,20 @@ class CustomActivity:BaseMVPActivity, CustomView {
}
```

## 混淆配置

部分组件需要进行混淆配置。请注意别遗漏了:

```
# EasyBundle
-keepclasseswithmembernames class * {
@com.haoge.easyandroid.easy.BundleField <fields>;
}
# EasySharedPreferences
-keep class * implements com.haoge.easyandroid.easy.PreferenceSupport { *; }
```

## 联系作者

<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>
Expand Down
4 changes: 1 addition & 3 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,10 @@ android {
targetSdkVersion 27
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
Expand All @@ -24,7 +23,6 @@ android {
def butterknife_version = '8.8.1'
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
implementation 'junit:junit:4.12'
implementation 'com.android.support:appcompat-v7:27.1.1'

implementation 'com.alibaba:fastjson:1.1.68.android'
Expand Down
8 changes: 8 additions & 0 deletions app/proguard-rules.pro
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,11 @@
# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile

# EasyBundle
-keepclasseswithmembernames class * {
@com.haoge.easyandroid.easy.BundleField <fields>;
}

# EasySharedPreferences
-keep class * implements com.haoge.easyandroid.easy.PreferenceSupport { *; }
Binary file added keys
Binary file not shown.
2 changes: 0 additions & 2 deletions utils/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@ android {
}

dependencies {
testImplementation 'junit:junit:4.12'

implementation "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"

compileOnly 'com.alibaba:fastjson:1.2.47'
Expand Down
6 changes: 3 additions & 3 deletions utils/src/main/java/com/haoge/easyandroid/easy/EasyLog.kt
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ class EasyLog private constructor(
private fun dispatchToLogPrinterThread(invoke:(Thread, StackTraceElement, String) -> Unit) {
val trace = findTrace()
val current = Thread.currentThread()
val tag = if (tag.isEmpty()) trace.fileName else tag
val tag = if (tag.isEmpty()) trace.fileName?:trace.className?:"unknown tag" else tag
this.tag = ""
if (immediate) {
invoke.invoke(current, trace, tag)
Expand Down Expand Up @@ -288,8 +288,8 @@ class EasyLog private constructor(

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

/**
Expand Down
151 changes: 0 additions & 151 deletions utils/src/test/java/com/haoge/easyandroid/easy/EasyReflectTest.java

This file was deleted.

This file was deleted.

0 comments on commit effa438

Please sign in to comment.