6

Recently my app got updated.The update included a dialog at startup loading webview in it. After going live my firebase console was loaded with crash regarding webview not installed. The crash report says

Caused by android.webkit.WebViewFactory$MissingWebViewPackageException: Failed to load WebView provider: No WebView installed
       at android.webkit.WebViewFactory.getWebViewContextAndSetProvider(WebViewFactory.java:339)
       at android.webkit.WebViewFactory.getProviderClass(WebViewFactory.java:402)
       at android.webkit.WebViewFactory.getProvider(WebViewFactory.java:252)
       at android.webkit.WebView.getFactory(WebView.java:2551)
       at android.webkit.WebView.ensureProviderCreated(WebView.java:2545)
       at android.webkit.WebView.setOverScrollMode(WebView.java:2613)
       at android.view.View.<init>(View.java:5441)
       at android.view.View.<init>(View.java:5632)
       at android.view.ViewGroup.<init>(ViewGroup.java:677)
       at android.widget.AbsoluteLayout.<init>(AbsoluteLayout.java:56)
       at android.webkit.WebView.<init>(WebView.java:410)
       at android.webkit.WebView.<init>(WebView.java:353)
       at android.webkit.WebView.<init>(WebView.java:336)
       at android.webkit.WebView.<init>(WebView.java:323)
       at java.lang.reflect.Constructor.newInstance0(Constructor.java)
       at java.lang.reflect.Constructor.newInstance(Constructor.java:343)
       at android.view.LayoutInflater.createView(LayoutInflater.java:854)
       at android.view.LayoutInflater.createView(LayoutInflater.java:776)
       at com.android.internal.policy.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:58)
       at android.view.LayoutInflater.onCreateView(LayoutInflater.java:930)
       at android.view.LayoutInflater.onCreateView(LayoutInflater.java:950)
       at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:1004)
       at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:961)
       at android.view.LayoutInflater.rInflate(LayoutInflater.java:1123)
       at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:1084)
       at android.view.LayoutInflater.rInflate(LayoutInflater.java:1126)
       at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:1084)
       at android.view.LayoutInflater.inflate(LayoutInflater.java:682)
       at android.view.LayoutInflater.inflate(LayoutInflater.java:534)
       at android.view.LayoutInflater.inflate(LayoutInflater.java:481)
       at android.support.v7.app.AppCompatDelegateImpl.setContentView(AppCompatDelegateImpl.java:469)
       at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:140)
       at com.myapp.ui.DialogActivity.onCreate(DialogActivity.kt:18)
       at android.app.Activity.performCreate(Activity.java:7981)
       at android.app.Activity.performCreate(Activity.java:7970)
       at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1307)
       at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3422)
       at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3594)
       at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:83)
       at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
       at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2146)
       at android.os.Handler.dispatchMessage(Handler.java:107)
       at android.os.Looper.loop(Looper.java:237)
       at android.app.ActivityThread.main(ActivityThread.java:7762)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1047)

This DialogActivity was loaded on startup. App was previously running smoothly with WebView which was launched from inside app menu and never crashed before. Now with this new update with WebView at startup the app crashes with this log.

I googled this question and came across with many other stackoverflow and google issue tracker answers which all says this occurs while WebView was inflated/initialized while being updated by the operating system and that nothing could be done about it, only try catch can save app from crashing.

References: android Failed to load WebView provider: No WebView installed https://groups.google.com/forum/#!topic/google-admob-ads-sdk/k94v72E NameNotFoundException webview

So my question is that this crash has appeared 33 times now in 5 days of time span in firebase console, is it really due to OS updating the WebView? Why its frequency is soo high? According to reports this crash occurred on 10 Android 10 and 1 Android 5.0.1 devices, Android 10 devices were all Samsung phones including: Galaxy Note10 Lite, Galaxy S20 5G, Galaxy S20 ultra 5G, Galaxy S10. Android 5.0.1 device was Huawei P8 Lite. However Huawei device showed a slightly different crash

Caused by android.content.pm.PackageManager$NameNotFoundException: com.google.android.webview
       at android.app.ApplicationPackageManager.getPackageInfo(ApplicationPackageManager.java:120)
       at android.webkit.WebViewFactory.getFactoryClass(WebViewFactory.java:137)
       at android.webkit.WebViewFactory.getProvider(WebViewFactory.java:105)
       at android.webkit.WebView.getFactory(WebView.java:2192)
       at android.webkit.WebView.ensureProviderCreated(WebView.java:2187)
       at android.webkit.WebView.setOverScrollMode(WebView.java:2246)
       at android.view.View.<init>(View.java:3591)
       at android.view.View.<init>(View.java:3685)
       at android.view.ViewGroup.<init>(ViewGroup.java:491)
       at android.widget.AbsoluteLayout.<init>(AbsoluteLayout.java:55)
       at android.webkit.WebView.<init>(WebView.java:538)
       at android.webkit.WebView.<init>(WebView.java:483)
       at android.webkit.WebView.<init>(WebView.java:466)
       at android.webkit.WebView.<init>(WebView.java:453)
       at java.lang.reflect.Constructor.newInstance(Constructor.java)
       at java.lang.reflect.Constructor.newInstance(Constructor.java:288)
       at android.view.LayoutInflater.createView(LayoutInflater.java:626)
       at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:55)
       at com.android.internal.policy.impl.HwPhoneLayoutInflater.onCreateView(HwPhoneLayoutInflater.java:75)
       at android.view.LayoutInflater.onCreateView(LayoutInflater.java:701)
       at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:760)
       at android.view.LayoutInflater.rInflate(LayoutInflater.java:825)
       at android.view.LayoutInflater.rInflate(LayoutInflater.java:828)
       at android.view.LayoutInflater.inflate(LayoutInflater.java:523)
       at android.view.LayoutInflater.inflate(LayoutInflater.java:425)
       at android.view.LayoutInflater.inflate(LayoutInflater.java:368)
       at android.support.v7.app.AppCompatDelegateImpl.setContentView(AppCompatDelegateImpl.java:469)
       at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:140)
       at com.myapp.ui.DialogActivity.onCreate(DialogActivity.kt:18)
       at android.app.Activity.performCreate(Activity.java:6013)
       at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1108)
       at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2359)
       at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2466)
       at android.app.ActivityThread.access$1200(ActivityThread.java:152)
       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1341)
       at android.os.Handler.dispatchMessage(Handler.java:102)
       at android.os.Looper.loop(Looper.java:135)
       at android.app.ActivityThread.main(ActivityThread.java:5538)
       at java.lang.reflect.Method.invoke(Method.java)
       at java.lang.reflect.Method.invoke(Method.java:372)
       at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:960)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:755)

But from some stackoverflow answers the reason behind this is also the same.

Is try catch the only solution to this or might I be doing something wrong here? Any insight on this would be really helpful and appreciated. Thanks.

Hamza Ahmed Khan
  • 476
  • 5
  • 19
  • We've seen this exact phenomenon since last Sunday, yet can only reproduce the issues with builds distributed through the Play Store (we did enable App Signing by Google). We're unable to reproduce the problem with locally-signed builds. – Diëgo Jun 12 '20 at 14:44
  • Did you try reproducing it with steps mentioned in this post https://stackoverflow.com/a/29809338/6722626 ? – Hamza Ahmed Khan Jun 16 '20 at 06:18

0 Answers0