Proguard 不要混淆内部类

来源:互联网 发布:怎么测试网络丢包率 编辑:程序博客网 时间:2024/05/21 09:47

 调用webview的js代码,跳转不过去,不混淆代码可以运行,混淆后就不行。这肯定是方法被混淆了,那么如何做呢?

 

# If your project uses WebView with JS, uncomment the following# and specify the fully qualified class name to the JavaScript interface# class:#-keepclassmembers class fqcn.of.javascript.interface.for.webview {#   public *;#}

正确的写法,写上类的绝对路径,类名 ,$ ,再就是内部类名称。

-keepclassmembers class com.dd.ActionActivity$ExpJavaScriptInterface {  public *;}

-keepattributes *Annotation*-keepattributes *JavascriptInterface*

4.2以上版本调用js接口需要在方法使用声明@JavascriptInterface,然后混淆时可能会弄丢该声明导致,程序无法调用js,需要继续再配置文件中添加条件

这样就Ok了。




0 0
原创粉丝点击