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

MissingWebViewPackageException: Failed to load WebView provider

Open lekeope opened this issue 5 years ago • 10 comments

Caused by android.webkit.WebViewFactory$MissingWebViewPackageException Failed to load WebView provider: No WebView installed

7 Crashes affecting 2 users, using Samsung SM-J701M with Android 7.0 Installed

lekeope avatar Apr 19 '19 23:04 lekeope

More info about this here Google should really fix this SDK seems like a rather easy fix https://stackoverflow.com/questions/46048912/android-failed-to-load-webview-provider-no-webview-installed

Izzyjm avatar Jun 03 '19 18:06 Izzyjm

whats the full stacktrace ?

Izzyjm avatar Jun 03 '19 19:06 Izzyjm

Fatal Exception: android.util.AndroidRuntimeException: android.webkit.WebViewFactory$MissingWebViewPackageException: Failed to load WebView provider: No WebView installed at android.webkit.WebViewFactory.getProviderClass + 371(WebViewFactory.java:371) at android.webkit.WebViewFactory.getProvider + 194(WebViewFactory.java:194) at android.webkit.WebView.getFactory + 2569(WebView.java:2569) at android.webkit.WebView.ensureProviderCreated + 2564(WebView.java:2564) at android.webkit.WebView.setOverScrollMode + 2629(WebView.java:2629) at android.view.View.(View.java:4043) at android.view.View.(View.java:4170) at android.view.ViewGroup.(ViewGroup.java:603)

lekeope avatar Jul 16 '19 11:07 lekeope

have you figured out the cause yet ?

Izzyjm avatar Jul 16 '19 21:07 Izzyjm

The problem comes from Android 7 because WebView is not working correctly.

lekeope avatar Jul 18 '19 08:07 lekeope

The exception says that webview package is missing, I wonder how this could be possible ? I don’t have a Android 7.0 device but I can try to reproduce on simulator maybe it will work ?

Izzyjm avatar Jul 18 '19 16:07 Izzyjm

Did you checked proguard configuration in file proguard-rules.pro for consent-library? Please for testing add and check if it fix your issue: -keep class com.google.ads.consent.* { *; }

witoldgoralski avatar Jul 18 '19 16:07 witoldgoralski

@witoldgoralski the issue is peculiar to android 7, so that's not the issue

lekeope avatar Jul 18 '19 17:07 lekeope

@Edge-Developer 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

Izzyjm avatar Jul 20 '19 08:07 Izzyjm

@Edge-Developer as that as far as your stack-trace goes ? so we could see what method from the consent SDK was the one that called it. As you can see in his stack trace(https://github.com/googleads/googleads-consent-sdk-android/issues/95) which is similar to yours it starts with "com.google.ads.consent.ConsentForm$Builder.build(ConsentForm.java:210)" so maybe where ever this method gets called put that in the try block how they did on the stack overflow posts

Izzyjm avatar Jul 20 '19 08:07 Izzyjm