I have the same problem. I also use Crashlytics Cordova and Fabric.
It only plays on Android 4.1.2, 4.2.2, 4.3.
I reproduced the error:
- open a WebView with content containing javascript functions;
- open a new WebView and close it;
- disconnect the network (Wi-Fi and mobile) as soon as possible;
- return to the application and show stacktrace.
I found a solution:
I do not use CordovaActivity in my application. I am using CordovaInterface. The PluginManager associated with the remote WebView continues to call its methods. Therefore, I manually call WebView.handleDestroy () to destroy the PluginManager.
In my fragment:
@Override public void onDestroy() { if (webView != null) { webView.handleDestroy(); webView.destroy(); webView = null; } super.onDestroy(); }
Update: It plays when the WebView is destroyed, but the PluginManager continues to live and sends javascripts events to subscribers (WebViews). Because I am calling WebView.handleDestroy ().
source share