googleads / googleads-consent-sdk-android

Consent SDK
https://developers.google.com/admob/android/eu-consent
Apache License 2.0
100 stars 82 forks source link

Failed to load WebView provider: No WebView installed #95

Open protoss5482 opened 5 years ago

protoss5482 commented 5 years ago

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)

Izzyjm commented 5 years ago

@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

softartdev commented 3 years ago

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.