android.webkit.WebViewFactory$MissingWebViewPackageException from Android 7.0

Viewed 9405

The following crash is reported occasionally (rarely), and only from Android 7.0 devices:

android.util.AndroidRuntimeException: 
  at android.webkit.WebViewFactory.getProviderClass (WebViewFactory.java:371)
  at android.webkit.WebViewFactory.getProvider (WebViewFactory.java:194)
  at android.webkit.WebViewDatabase.getInstance (WebViewDatabase.java:38)
  at com.amazon.device.ads.AdLayout.isWebViewDatabaseNull (SourceFile:352)
  at com.amazon.device.ads.AdLayout.initializeIfNecessary (SourceFile:260)
  at com.amazon.device.ads.AdLayout.getAdController (SourceFile:303)
  at com.amazon.device.ads.AdLayout.onLayout (SourceFile:478)
  at android.view.View.layout (View.java:17838)
  at android.view.ViewGroup.layout (ViewGroup.java:5754)
  at android.widget.RelativeLayout.onLayout (RelativeLayout.java:1189)
  at android.view.View.layout (View.java:17838)
  at android.view.ViewGroup.layout (ViewGroup.java:5754)
  at android.widget.RelativeLayout.onLayout (RelativeLayout.java:1189)
  at android.view.View.layout (View.java:17838)
  at android.view.ViewGroup.layout (ViewGroup.java:5754)
  at android.widget.LinearLayout.setChildFrame (LinearLayout.java:1982)
  at android.widget.LinearLayout.layoutVertical (LinearLayout.java:1826)
  at android.widget.LinearLayout.onLayout (LinearLayout.java:1735)
  at android.view.View.layout (View.java:17838)
  at android.view.ViewGroup.layout (ViewGroup.java:5754)
  at android.widget.FrameLayout.layoutChildren (FrameLayout.java:383)
  at android.widget.FrameLayout.onLayout (FrameLayout.java:321)
  at android.view.View.layout (View.java:17838)
  at android.view.ViewGroup.layout (ViewGroup.java:5754)
  at android.widget.FrameLayout.layoutChildren (FrameLayout.java:383)
  at android.widget.FrameLayout.onLayout (FrameLayout.java:321)
  at android.view.View.layout (View.java:17838)
  at android.view.ViewGroup.layout (ViewGroup.java:5754)
  at android.widget.LinearLayout.setChildFrame (LinearLayout.java:1982)
  at android.widget.LinearLayout.layoutVertical (LinearLayout.java:1826)
  at android.widget.LinearLayout.onLayout (LinearLayout.java:1735)
  at android.view.View.layout (View.java:17838)
  at android.view.ViewGroup.layout (ViewGroup.java:5754)
  at android.widget.FrameLayout.layoutChildren (FrameLayout.java:383)
  at android.widget.FrameLayout.onLayout (FrameLayout.java:321)
  at android.view.View.layout (View.java:17838)
  at android.view.ViewGroup.layout (ViewGroup.java:5754)
  at android.widget.LinearLayout.setChildFrame (LinearLayout.java:1982)
  at android.widget.LinearLayout.layoutVertical (LinearLayout.java:1826)
  at android.widget.LinearLayout.onLayout (LinearLayout.java:1735)
  at android.view.View.layout (View.java:17838)
  at android.view.ViewGroup.layout (ViewGroup.java:5754)
  at android.widget.FrameLayout.layoutChildren (FrameLayout.java:383)
  at android.widget.FrameLayout.onLayout (FrameLayout.java:321)
  at com.android.internal.policy.DecorView.onLayout (DecorView.java:751)
  at android.view.View.layout (View.java:17838)
  at android.view.ViewGroup.layout (ViewGroup.java:5754)
  at android.view.ViewRootImpl.performLayout (ViewRootImpl.java:2698)
  at android.view.ViewRootImpl.performTraversals (ViewRootImpl.java:2371)
  at android.view.ViewRootImpl.doTraversal (ViewRootImpl.java:1462)
  at android.view.ViewRootImpl$TraversalRunnable.run (ViewRootImpl.java:6960)
  at android.view.Choreographer$CallbackRecord.run (Choreographer.java:907)
  at android.view.Choreographer.doCallbacks (Choreographer.java:709)
  at android.view.Choreographer.doFrame (Choreographer.java:644)
  at android.view.Choreographer$FrameDisplayEventReceiver.run (Choreographer.java:893)
  at android.os.Handler.handleCallback (Handler.java:836)
  at android.os.Handler.dispatchMessage (Handler.java:103)
  at android.os.Looper.loop (Looper.java:208)
  at android.app.ActivityThread.main (ActivityThread.java:6267)
  at java.lang.reflect.Method.invoke (Native Method)
  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run (ZygoteInit.java:1063)
  at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:924)
Caused by: android.webkit.WebViewFactory$MissingWebViewPackageException: 
  at android.webkit.WebViewFactory.getWebViewContextAndSetProvider (WebViewFactory.java:270)
  at android.webkit.WebViewFactory.getProviderClass (WebViewFactory.java:330)

The stack trace does not contain anything related to the app, so I do not know where to look into this. Could anyone shed some light on this? How to prevent this?

2 Answers

Check if you have the package com.google.android.webview and if it is active.

It's possible that in order to 'debloat' your phone you disabled it, for example via pm disable com.google.android.webview (if rooted) or pm disable-user --user 0 com.google.android.webview (if not rooted).

It can be re-enabled via Settings > Apps (show system apps) > Android System WebView > Enable or via a terminal (requires adb debugging to be enabled in settings):

pm enable com.google.android.webview

If it is enabled then try the option Uninstall Updates in Settings > Apps — sometimes system upgrades or upgrades via Google Play might install a buggy version of WebView.

Another option is to go to https://play.google.com/store/apps/details?id=com.google.android.webview and install the update if one is available. If it doesn't fix the error then uninstall it so that your device falls back to its original system webview that came with the stock ROM.

Related