I am using Ionic framework to build the hybrid Android app and the app works fine. I am using Fabric Crash analytics plugin and its reporting the crashes of the app.
I am getting the below crash details very often and not sure what's the reason for the same. I am not sure what would be the starting point to start analysizing this.
Fatal Exception: java.lang.NullPointerException
at android.webkit.WebViewClassic.setNetworkAvailable(WebViewClassic.java:4224)
at android.webkit.WebView.setNetworkAvailable(WebView.java:731)
at org.apache.cordova.engine.SystemWebViewEngine$1.setNetworkAvailable(SystemWebViewEngine.java:112)
at org.apache.cordova.NativeToJsMessageQueue$OnlineEventsBridgeMode$2.run(NativeToJsMessageQueue.java:340)
at android.os.Handler.handleCallback(Handler.java:725)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:176)
at android.app.ActivityThread.main(ActivityThread.java:5319)
at java.lang.reflect.Method.invokeNative(Method.java)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1102)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:869)
at dalvik.system.NativeStart.main(NativeStart.java)
Is it related to any plugin or any issue in Ionic or Cordvoa? Any help or advise would be helpful.
I have the same problem. I also use Cordova and Fabric Crashlytics.
It's reproduced only on Android 4.1.2, 4.2.2, 4.3.
I have reproduced the bug:
I found a solution:
I'm not using CordovaActivity in my app. I'm using CordovaInterface. PluginManager associated with deleted WebView continues to call its methods. So I manual call WebView.handleDestroy() to destroy PluginManager.
In my Fragment:
@Override
public void onDestroy()
{
if (webView != null)
{
webView.handleDestroy();
webView.destroy();
webView = null;
}
super.onDestroy();
}
Update: It's reproduced when you destroy WebView, but PluginManager continues to live and sends javascripts events to subscribers (WebViews). Because I call WebView.handleDestroy().
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With