AddJavascriptInterface obfuscation method of WebView in Android

The entire method of addJavascriptInterface is 

 
android.webkit. WebView .addJavascriptInterface( Object  object,  String  name)

A general example is as follows:

webView.addJavascriptInterface(new MyJavaScriptInterface(), "myContent");

 

where MyJavaScriptInterface is the inner class:

public class MyJavaScriptInterface {
@JavascriptInterface
public String getContent() {
return content;
}
}

 

Then we need to declare MyJavaScriptInterface in the obfuscated script, otherwise it cannot be called.

 

-keepattributes *Annotation*

-keepattributes *JavascriptInterface*

-keepclassmembers class {包名}$MyJavaScriptInterface {
   public *;
}

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326220808&siteId=291194637