Today there is a bug, is WebView and JS Interactive method How also can not adjust, debug package No problem, release package on the wrong, think is packing confused problem, played a not confused bag, sure enough, is confusing problem.
And then find the solution, and in the Proguard-project file there's 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-
class name to th E JavaScript Interface
# class:
#-keepclassmembers class Fqcn.of.javascript.interface.for.webview {
# Public *;
#}</span>
Remove the annotation and replace the Fqcn.of.javascript.interface.for.webview with the class name you defined (the package name must also have, if the definition is an inner class, 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, it is 4.2 above version call JS interface in the method to use the declaration @javascriptinterface, and then confusion may lose the statement caused, Program can not call JS, you need to continue to add conditions in the configuration file,
-keepattributes *annotation*
-keepattributes *javascriptinterface*
So when using WebView and JS interactions, you should add these configurations to the obfuscation file:
-keepclassmembers class Cn.xx.xx.activity$appandroid {public
*;
}
-keepattributes *annotation*
-keepattributes *javascriptinterface*