或作或辍,一曝十寒,则虽读书百年,吾未见其可也。——(明)吴梦祥
原因:
使用 @android.webkit.JavascriptInterface
和 JavascriptInterface
原因导致加密后找不到这个类的方法,主要是加密后原有的类下方法是普通的annotation,无法导入js交互中。
// Compiled from JavascriptInterface.java (version 1.5 : 49.0, no super bit)
@java.lang.annotation.Retention(value=java.lang.annotation.RetentionPolicy.RUNTIME)
@java.lang.annotation.Target(value={java.lang.annotation.ElementType.METHOD})
public abstract @interface android.webkit.JavascriptInterface extends java.lang.annotation.Annotation {}
加密过程的警告可以忽略:
Note: the configuration refers to the unknown class 'com.xx.WebViewActivity.JavascriptInterface'Maybe you meant the fully qualified name 'android.webkit.JavascriptInterface'?
Note: the configuration refers to the unknown class com.xx.WebViewActivity.JavascriptInterface'Maybe you meant the fully qualified name 'android.webkit.JavascriptInterface'?
Note: the configuration refers to the unknown class 'com.xx.WebViewActivity.JavascriptInterface'Maybe you meant the fully qualified name 'android.webkit.JavascriptInterface'?
Note: the configuration refers to the unknown class 'JavascriptInterface'Maybe you meant the fully qualified name 'android.webkit.JavascriptInterface'?
Note: there were 4 references to unknown classes.You should check your configuration for typos.
Note: there were 1 unresolved dynamic references to classes or interfaces.You should check if you need to specify additional program jars.
Note: there were 1 accesses to class members by means of introspection.You should consider explicitly keeping the mentioned class members(using '-keep' or '-keepclassmembers').
最后解决:
-keepclassmembers class com.xx.WebViewActivity$JavascriptInterface {public ;public ;
}# keep annotated by JavascriptInterface
-keep @com.xx..WebViewActivity.JavascriptInterface class * {;;
}-keep class * {@com.xx.WebViewActivity.JavascriptInterface;
}-keepclassmembers class * {@com.xx.WebViewActivity.JavascriptInterface;
}-keep class android.support.** {;;
}-keep class com.xx.WebViewActivity.** {;;
}-keepclassmembers classcom.xx.WebViewActivity$JavascriptInterface {;
}
推荐文章:
- 经典:IT行业的“灰产”解密,一定要转发的“十大”理由
- Python 【精】AttributeError: ‘Module’ object has no attribute ‘STARTF_USESHOWINDOW’
- 作为程序员的你,会选择奋斗在一线城市还是回归故乡发展?
|| 版权声明:本文为博主杜锦阳原创文章,转载请注明出处。