Skip to content

Commit

Permalink
将混淆配置打包在aar中
Browse files Browse the repository at this point in the history
  • Loading branch information
wyouflf committed Jun 18, 2020
1 parent c970207 commit 7654e54
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 23 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@ xUtils 包含了orm, http(s), image, view注解, 但依然很轻量级(251K),
* 支持圆角, 圆形, 方形等裁剪, 支持自动旋转...

#### 4. `view注解`: view注解模块仅仅400多行代码却灵活的支持了各种View注入和事件绑定.
* 事件注解支持且不受混淆影响...(参考sample的混淆配置)
* 事件注解支持且不受混淆影响...([参考混淆配置](xutils/consumer-rules.pro))
* 支持绑定拥有多个方法的listener

#### 使用Gradle构建时添加以下依赖即可:
```javascript
implementation 'org.xutils:xutils:3.8.11'
implementation 'org.xutils:xutils:3.8.12'
```

#### 混淆配置参考示例项目sample的配置
Expand Down
20 changes: 1 addition & 19 deletions sample/proguard-rules.pro
Original file line number Diff line number Diff line change
Expand Up @@ -14,22 +14,4 @@
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}

################### region for xUtils
-keepattributes Signature,*Annotation*
-keep public class org.xutils.** {
public protected *;
}
-keep public interface org.xutils.** {
public protected *;
}
-keepclassmembers class * extends org.xutils.** {
public protected *;
}
-keepclassmembers @org.xutils.db.annotation.* class * {*;}
-keepclassmembers @org.xutils.http.annotation.* class * {*;}
-keepclassmembers class * {
@org.xutils.view.annotation.Event <methods>;
}
#################### end region
#}
2 changes: 1 addition & 1 deletion sample/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@
<string name="remove">移除</string>
<string name="stop">停止</string>
<string name="start">开始下载</string>
<string name="test_download_url">http://dl.bintray.com/wyouflf/maven/org/xutils/xutils/3.8.11/xutils-3.8.11.aar</string>
<string name="test_download_url">http://dl.bintray.com/wyouflf/maven/org/xutils/xutils/3.8.12/xutils-3.8.12.aar</string>
</resources>
4 changes: 3 additions & 1 deletion xutils/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ apply plugin: 'com.jfrog.bintray'
def siteUrl = 'https://github.com/wyouflf/xUtils3'
def gitUrl = 'https://github.com/wyouflf/xUtils3.git'
group = "org.xutils"
version = "3.8.11"
version = "3.8.12"

android {
compileSdkVersion 29
Expand All @@ -15,6 +15,8 @@ android {
minSdkVersion 14
versionCode 20200616
versionName version

consumerProguardFiles "consumer-rules.pro"
}
buildTypes {
debug {
Expand Down
15 changes: 15 additions & 0 deletions xutils/consumer-rules.pro
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
-keepattributes Signature,*Annotation*
-keep public class org.xutils.** {
public protected *;
}
-keep public interface org.xutils.** {
public protected *;
}
-keepclassmembers class * extends org.xutils.** {
public protected *;
}
-keepclassmembers @org.xutils.db.annotation.* class * {*;}
-keepclassmembers @org.xutils.http.annotation.* class * {*;}
-keepclassmembers class * {
@org.xutils.view.annotation.Event <methods>;
}

0 comments on commit 7654e54

Please sign in to comment.