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

MissingWebViewPackageException: Failed to load WebView provider #93

Open lekeope opened 5 years ago

lekeope commented 5 years ago

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

Izzyjm commented 5 years ago

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 commented 5 years ago

whats the full stacktrace ?

lekeope commented 5 years ago

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)

Izzyjm commented 5 years ago

have you figured out the cause yet ?

lekeope commented 5 years ago

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

Izzyjm commented 5 years ago

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 ?

witoldgoralski commented 5 years ago

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. { ; }

lekeope commented 5 years ago

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

Izzyjm commented 5 years ago

@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 commented 5 years ago

@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