googleads-consent-sdk-android icon indicating copy to clipboard operation
googleads-consent-sdk-android copied to clipboard

Failed to load WebView provider: No WebView installed

Open protoss5482 opened this issue 6 years ago • 2 comments

implementation 'com.google.android.ads.consent:consent-library:1.0.7'

Android 5, 6, 7

Top devices: Samsung Galaxy Grand Prime Pro Samsung Galaxy Note3 Samsung SM-G950

Caused by android.util.AndroidRuntimeException: android.webkit.WebViewFactory$MissingWebViewPackageException: Failed to load WebView provider: No WebView installed at android.webkit.WebViewFactory.getProviderClass(WebViewFactory.java:371) at android.webkit.WebViewFactory.getProvider(WebViewFactory.java:194) at android.webkit.WebView.getFactory(WebView.java:2325) at android.webkit.WebView.ensureProviderCreated(WebView.java:2320) at android.webkit.WebView.setOverScrollMode(WebView.java:2379) at android.view.View.<init>(View.java:4371) at android.view.View.<init>(View.java:4519) at android.view.ViewGroup.<init>(ViewGroup.java:582) at android.widget.AbsoluteLayout.<init>(AbsoluteLayout.java:55) at android.webkit.WebView.<init>(WebView.java:627) at android.webkit.WebView.<init>(WebView.java:572) at android.webkit.WebView.<init>(WebView.java:555) at android.webkit.WebView.<init>(WebView.java:542) at android.webkit.WebView.<init>(WebView.java:532) at com.google.ads.consent.ConsentForm.<init>(ConsentForm.java:80) at com.google.ads.consent.ConsentForm.<init>(ConsentForm.java:46) at com.google.ads.consent.ConsentForm$Builder.build(ConsentForm.java:210)

protoss5482 avatar May 27 '19 20:05 protoss5482

@protoss5482 I did some research and found out this happens because the "Android System WebView" started being installed as its own application from Android 5.0 and greater and this code happens to be running while "Android System WebView" is being updated. While its being updated the package doesn't exist so it causes this exception. People on the bug tracker said chrome and android were not going to fix this because it's normal behavior and up to developer to handle it. I think now you could close out this issue.

Possible solution try { }catch (Exception e) { }

References https://stackoverflow.com/questions/46278681/android-webkit-webviewfactorymissingwebviewpackageexception-from-android-7-0

https://stackoverflow.com/questions/46048912/android-failed-to-load-webview-provider-no-webview-installed

https://stackoverflow.com/questions/29575313/namenotfoundexception-webview

https://bugs.chromium.org/p/chromium/issues/detail?id=506369

https://issuetracker.google.com/issues/37048374

ijm700 avatar Jul 20 '19 08:07 ijm700

Easy way to check WebView packages provided by androidx.webkit library with WebViewCompat.getCurrentWebViewPackage method, more detail solution on StackOverFlow. Obviously relate to another issue.

softartdev avatar Feb 20 '21 18:02 softartdev