I'm exposing @JavascriptInterface
callbacks for a WebView which work just fine when debugging the app via Android Studio, however if the app is installed via APK the JavaScript callbacks fail with:
"Uncaught TypeError: NativeApp.onProgress is not a function"
I'm aware that improper Proguard rules can result in this problem, but in this case the project is not using Proguard and the problem occurs with debug and release APKS.
If I inspect the APKs, the methods are present.
public class MyServiceWithEmbeddedWebView {
...
public createWebview() {
...
webView.addJavascriptInterface(this, "NativeApp");
...
}
@JavascriptInterface
void onProgress(int loaded, int total) {
...
}
...
}
Any ideas?