Today there is a bug, that is, WebView and JS interaction method can not be adjusted, Debug package problem, release package on the error, think is the problem of packaging confusion, hit a not confused package, sure enough, is the problem of confusion.
And then just find the solution, in the Proguard-project file there is a sentence
<span style= "FONT-FAMILY:KAITI_GB2312;FONT-SIZE:14PX;" ># If your project uses WebView with JS, uncomment the following# and specify the fully qualified class name to the Jav Ascript interface# Class:#-keepclassmembers class Fqcn.of.javascript.interface.for.webview {# public *;#}</ Span>
lift the note and put Fqcn.of.javascript.interface.for.webview The class name you define yourself (the package name must also have, if the inner class is defined, it is cn.wj.ui.webviewactivity$ MyInterface), in 4.1 of the system is no problem, but 4.2 of the machine or not, and then look for, oh, the original is more than 4.2 version of the call JS interface needs in the method to use the declaration @ Javascriptinterface, and then confusion may be lost when the declaration is caused, the program cannot invoke JS, need to continue to add conditions in the configuration file,
-keepattributes *annotation*
-keepattributes *javascriptinterface*
So when using WebView and JS interactions, these configurations should be added to the obfuscation file:
-keepclassmembers class Cn.xx.xx.activity$appandroid {public *;} -keepattributes *annotation*-keepattributes *javascriptinterface*
When JS is called in Android WebView, it is confusing to note