As the title says: 3.8.6 ios high performance mode loading code subpackage error, (the same code runs normally without high performance mode) What could be the possible reason? Mainly because there is no detailed js error information
I encountered the same problem as you. I can call native Android methods in the RunoseAI web project, but Android fails to access the JS in the Web project and keeps prompting “test is not a function”. How do you solve this problem?
I would like to ask you how did you solve the problem of Android accessing web projects?
js access android method in webview
First, set webview in android
webView.addJavascriptInterface(this, “android”);
webSettings.setJavaScriptEnabled(true);
android here can be replaced with the string you want Then register the method @JavascriptInterface
in the webview’s activty public void test(String aaa){ Log.i(“test”, aaa); } Just add @JavascriptInterface to the java method
Call window.android.test(“aaa”) in js ;
it is recommended to determine the platform and system to see if the method exists.
Android calls js
Register method in js
window.test = function(aaa){
console.log(aaa);
} Call webView.loadUrl(“javascript:if(window.test) {window.test( "123");}”);
in android, note that it is called in the main thread