Skip to content

Commit

Permalink
Merge pull request alibaba#245 from alibaba/develop
Browse files Browse the repository at this point in the history
Update proguard rules.
  • Loading branch information
zhi1ong authored Nov 21, 2017
2 parents d015d9b + 1aebf21 commit 02b21a4
Show file tree
Hide file tree
Showing 6 changed files with 84 additions and 5 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# Built application files
*.apk
*.ap_

# Files for the Dalvik VM
Expand Down
8 changes: 7 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

#### Demo展示

##### [Demo apk下载](http://public.cdn.zhilong.me/app-debug.apk)[Demo Gif](https://raw.githubusercontent.com/alibaba/ARouter/master/demo/arouter-demo.gif)
##### [Demo apk下载](https://github.com/alibaba/ARouter/blob/develop/demo/arouter-demo.apk)[Demo Gif](https://raw.githubusercontent.com/alibaba/ARouter/master/demo/arouter-demo.gif)

#### 一、功能介绍
1. **支持直接解析标准URL进行跳转,并自动注入参数到目标页面中**
Expand Down Expand Up @@ -99,6 +99,12 @@ ARouter.getInstance().build("/test/1")
```
-keep public class com.alibaba.android.arouter.routes.**{*;}
-keep class * implements com.alibaba.android.arouter.facade.template.ISyringe{*;}
# 如果使用了 byType 的方式获取 Service,需添加下面规则,保护接口
-keep interface * implements com.alibaba.android.arouter.facade.template.IProvider
# 如果使用了 单类注入,即不定义接口实现 IProvider,需添加下面规则,保护实现
-keep class * implements com.alibaba.android.arouter.facade.template.IProvider
```

#### 四、进阶用法
Expand Down
8 changes: 7 additions & 1 deletion README_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

#### Demo展示

##### [Demo apk下载](http://public.cdn.zhilong.me/app-debug.apk)[Demo Gif](https://raw.githubusercontent.com/alibaba/ARouter/master/demo/arouter-demo.gif)
##### [Demo apk下载](https://github.com/alibaba/ARouter/blob/develop/demo/arouter-demo.apk)[Demo Gif](https://raw.githubusercontent.com/alibaba/ARouter/master/demo/arouter-demo.gif)

#### 一、功能介绍
1. **支持直接解析标准URL进行跳转,并自动注入参数到目标页面中**
Expand Down Expand Up @@ -99,6 +99,12 @@ ARouter.getInstance().build("/test/1")
```
-keep public class com.alibaba.android.arouter.routes.**{*;}
-keep class * implements com.alibaba.android.arouter.facade.template.ISyringe{*;}
# 如果使用了 byType 的方式获取 Service,需添加下面规则,保护接口
-keep interface * implements com.alibaba.android.arouter.facade.template.IProvider
# 如果使用了 单类注入,即不定义接口实现 IProvider,需添加下面规则,保护实现
-keep class * implements com.alibaba.android.arouter.facade.template.IProvider
```

#### 四、进阶用法
Expand Down
5 changes: 3 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,9 @@ android {
}

release {
minifyEnabled false
signingConfig null
minifyEnabled true
signingConfig signingConfigs.debug
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}

Expand Down
67 changes: 67 additions & 0 deletions app/proguard-rules.pro
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
-optimizationpasses 5
-dontpreverify
-dontwarn
-ignorewarnings
-verbose
-overloadaggressively
-dontusemixedcaseclassnames
-dontskipnonpubliclibraryclasses
-dontskipnonpubliclibraryclassmembers
-keepattributes EnclosingMethod, *Annotation*, *JavascriptInterface*, InnerClasses, Signature
-optimizations !code/simplification/arithmetic,!field/*,!class/merging/*

# Android Framework
-keep public class * extends android.app.Activity
-keep public class * extends android.app.Application
-keep public class * extends android.app.Service
-keep public class * extends android.content.BroadcastReceiver
-keep public class * extends android.content.ContentProvider
-keep public class * extends android.app.backup.BackupAgentHelper
-keep public class * extends android.preference.Preference
-keep public class com.android.vending.licensing.ILicensingService

-keepclasseswithmembers class * {
public <init>(android.content.Context,android.util.AttributeSet);
}

-keepclasseswithmembers class * {
public <init>(android.content.Context,android.util.AttributeSet,int);
}

-keep class * extends android.os.Parcelable {
public static final android.os.Parcelable$Creator *;
}

-keepclasseswithmembernames class * {
native <methods>;
}

-keepclasseswithmembers,allowshrinking class * {
native <methods>;
}

-keepclassmembers enum * {
public static **[] values();
public static ** valueOf(java.lang.String);
}

-keepclassmembers class **.R$* {
public static <fields>;
}

-keepclassmembers class * extends android.content.Context {
public void *(android.view.View);
public void *(android.view.MenuItem);
}

-keepclassmembers class * extends android.app.Activity {
public void *(android.view.View);
}

-dontwarn com.alibaba.fastjson.**
-keep class com.alibaba.fastjson.**{*;}

# ARouter
-keep public class com.alibaba.android.arouter.routes.**{*;}
-keep class * implements com.alibaba.android.arouter.facade.template.ISyringe{*;}
-keep interface * implements com.alibaba.android.arouter.facade.template.IProvider
Binary file added demo/arouter-demo.apk
Binary file not shown.

0 comments on commit 02b21a4

Please sign in to comment.