Http://www.androidren.com/index.php?qa=282&qa_1=android JS calls Java code or uses JavaScript-related techniques to change how to confuse
Android 4.2 Start JS call Java code must add @JavascriptInterface to call.
Add @JavascriptInterface after you have to consider the confusion of the time of the problem, if confused when the @JavascriptInterface lost your program can not be called.
It's really simple, you just need to add in the confusion:
-keepattributes Annotation
-keepattributes Javascriptinterface
At the same time, the relevant code also needs to add Keep:
-keep Public class Com.google.android.webviewdemo. Webviewdemo. Demojavascriptinterface
-keep Public class * implementsCom.google.android.webviewdemo. Webviewdemo. Demojavascriptinterface
-keepclassmembers Class * implements Com.google.android.webviewdemo. Webviewdemo. Demojavascriptinterface {
*;
}
Android JS calls Java code or uses JavaScript-related techniques to change how to confuse