Skip to content

Commit

Permalink
add proguard.txt
Browse files Browse the repository at this point in the history
  • Loading branch information
pedant committed Nov 6, 2014
1 parent a8b0231 commit 69ceeee
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 7 deletions.
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -140,22 +140,22 @@ Java层方法可以返回void 或 能转为字符串的类型(如int、long、
}

### 发布时防混淆
发布时需在你的混淆配置加入像下面这样的代码,注意**返回到页面的自定义Java类以及注入到页面的接口类都要换成你项目中使用实际类名**:
发布时需在你的混淆配置加入像下面这样的代码,注意返回到页面的自定义Java类以及注入到页面的接口类都要**换成你项目中实际使用类名**:

##--------------- BEGIN: Gson防混淆 ----------
#--------------- BEGIN: Gson防混淆 ----------
-keepattributes *Annotation*
-keep class sun.misc.Unsafe { *; }
-keep class com.idea.fifaalarmclock.entity.***
-keep class com.google.gson.stream.** { *; }
##--------------- END ----------
#--------------- END ----------

##--------------- BEGIN: 返回到页面的自定义Java对象防混淆 ----------
#--------------- BEGIN: 返回到页面的自定义Java对象防混淆 ----------
-keepclassmembers class cn.pedant.SafeWebViewBridge.sample.HostJsScope$RetJavaObj{ *; }
##--------------- END ----------
#--------------- END ----------

##--------------- BEGIN: 注入到页面的接口类防混淆 ----------
#--------------- BEGIN: 注入到页面的接口类防混淆 ----------
-keepclassmembers class cn.pedant.SafeWebViewBridge.sample.HostJsScope{ *; }
##--------------- END ----------
#--------------- END ----------

### 小心过大数字
JS中使用过大数字时,可能会导致精度丢失或者错误的数字结果,如下面:
Expand Down
14 changes: 14 additions & 0 deletions sample/proguard-android.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#--------------- BEGIN: Gson防混淆 ----------
-keepattributes *Annotation*
-keep class sun.misc.Unsafe { *; }
-keep class com.idea.fifaalarmclock.entity.***
-keep class com.google.gson.stream.** { *; }
#--------------- END ----------

#--------------- BEGIN: 返回给页面的自定义Java对象防混淆 ----------
-keepclassmembers class cn.pedant.SafeWebViewBridge.sample.HostJsScope$RetJavaObj{ *; }
#--------------- END ----------

#--------------- BEGIN: 注入到页面的接口类防混淆 ----------
-keepclassmembers class cn.pedant.SafeWebViewBridge.sample.HostJsScope{ *; }
#--------------- END ----------

0 comments on commit 69ceeee

Please sign in to comment.