Tealium / tealium-kotlin

Tealium Kotlin Integration Library
Other
8 stars 11 forks source link

Failed to load WebView provider: No WebView installed #229

Closed giovanniPolatoO closed 9 months ago

giovanniPolatoO commented 11 months ago

In my project I've been reported some many crash about android.webkit.WebViewFactory$MissingWebViewPackageException - Failed to load WebView provider: No WebView installed

Can you solve? Or tell me how to solve?

I already import via Gradle implementation "androidx.webkit:webkit:1.7.0"

OS: Android GO 11

jameskeith commented 11 months ago

Hi @giovanniPolatoO

Do you happen to have a crash stack trace available for these incidents?

Also, are you able to confirm which version of the Tealium Kotlin SDK you are using? The only module we use a WebView in is com.tealium:kotlin-tagmanagement-dispatcher so the version of that artefact would be useful to know - the later versions should be catching exceptions thrown by WebView creation.

My understanding of this particular error is that the System WebView Package is either not preset, disabled or is being updated at the time a WebView is being instantiated.

In those cases, I don't believe there is much we can do about it other than to catch and log the failure, then retry. I believe that v1.1.3+ of the TagManagement Dispatcher should already be doing that.

giovanniPolatoO commented 11 months ago

I use com.tealium:kotlin-tagmanagement-dispatcher:1.2.1.

Fatal Exception: android.util.AndroidRuntimeException: android.util.AndroidRuntimeException: android.webkit.WebViewFactory$MissingWebViewPackageException: Failed to load WebView provider: No WebView installed at android.webkit.WebViewFactory.getProvider(WebViewFactory.java:363) at android.webkit.WebView.getFactory(WebView.java:2594) at android.webkit.WebView.ensureProviderCreated(WebView.java:2588) at android.webkit.WebView.setOverScrollMode(WebView.java:2656) at android.view.View.<init>(View.java:5313) at android.view.View.<init>(View.java:5454) at android.view.ViewGroup.<init>(ViewGroup.java:703) at android.widget.AbsoluteLayout.<init>(AbsoluteLayout.java:56) at android.webkit.WebView.<init>(WebView.java:421) at android.webkit.WebView.<init>(WebView.java:363) at android.webkit.WebView.<init>(WebView.java:345) at android.webkit.WebView.<init>(WebView.java:332) at android.webkit.WebView.<init>(WebView.java:322) **at com.tealium.tagmanagementdispatcher.d$b.invokeSuspend(d.java:4)** at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(BaseContinuationImpl.java:33) at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.java:106) at android.os.Handler.handleCallback(Handler.java:938) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loopOnce(Looper.java:201) at android.os.Looper.loop(Looper.java:288) at android.app.ActivityThread.main(ActivityThread.java:7886) at java.lang.reflect.Method.invoke(Method.java) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:568) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1045)

jameskeith commented 11 months ago

@giovanniPolatoO - Are you absolutely certain that this specific crash is using v1.2.1 of the Tag Management Dispatcher? i.e it's not an old version of the app that may have shipped with older dependencies? or that gradle/maven is perhaps resolving the dependency differently to what you've set in the build.gradle

The reason I ask, is that I've just launched a test app using v1.2.1, but I've disabled the System WebView on the device, and as expected I do see that error message logged in the Android logcat but no crash since the error is caught/handled (truncated stack-trace below)

Incidentally, the crashing code in my stacktrace is coming from a different class to yours - these are obfuscated by us before release so they would be consistent on your system. So I've reviewed our published artefacts, and from v1.1.1 and above I would expect to see the following two lines in that crash:

at com.tealium.tagmanagementdispatcher.d.invoke(SourceFile:1)
at com.tealium.tagmanagementdispatcher.e$b.invokeSuspend(SourceFile:47)

Whereas your stacktrace uses com.tealium.tagmanagementdispatcher.d$b.invokeSuspend - note d$b instead of e$b - which would suggest to me that this is coming from version 1.1.0 or below. Class d$b doesn't exist in the v1.2.1 artefact.

2023-11-22 11:42:39.823 20989-20989 Tealium-Ta...cher-1.2.1 com.tealium.mobile                   I  Exception whilst creating the WebView: android.util.AndroidRuntimeException: android.webkit.WebViewFactory$MissingWebViewPackageException: Failed to load WebView provider: No WebView installed
2023-11-22 11:42:39.824 20989-20989 Tealium-Ta...cher-1.2.1 com.tealium.mobile                   I  android.util.AndroidRuntimeException: android.util.AndroidRuntimeException: android.webkit.WebViewFactory$MissingWebViewPackageException: Failed to load WebView provider: No WebView installed
at android.webkit.WebViewFactory.getProvider(WebViewFactory.java:363)
at android.webkit.WebView.getFactory(WebView.java:2594)
at android.webkit.WebView.ensureProviderCreated(WebView.java:2588)
at android.webkit.WebView.setOverScrollMode(WebView.java:2656)
at android.view.View.<init>(View.java:5370)
at android.view.View.<init>(View.java:5511)
at android.view.ViewGroup.<init>(ViewGroup.java:703)
at android.widget.AbsoluteLayout.<init>(AbsoluteLayout.java:56)
at android.webkit.WebView.<init>(WebView.java:421)
at android.webkit.WebView.<init>(WebView.java:363)
at android.webkit.WebView.<init>(WebView.java:345)
at android.webkit.WebView.<init>(WebView.java:332)
at android.webkit.WebView.<init>(WebView.java:322)
at com.tealium.tagmanagementdispatcher.d.invoke(SourceFile:1)
at com.tealium.tagmanagementdispatcher.e$b.invokeSuspend(SourceFile:47)
...
giovanniPolatoO commented 11 months ago

This are all the implementation relative to Tealium in my build.gradle


    implementation 'com.tealium:kotlin-tagmanagement-dispatcher:1.2.1'
    implementation 'com.tealium:kotlin-lifecycle:1.2.0'
    implementation 'com.tealium:kotlin-ad-identifier:1.1.2'
    implementation 'com.android.installreferrer:installreferrer:2.2'
    implementation 'com.tealium:kotlin-location:1.1.2'
    implementation 'com.tealium:kotlin-remotecommand-dispatcher:1.3.1'
    implementation 'com.tealium:remotecommands:1.0.1'
    implementation 'com.tealium:kotlin-visitor-service:1.2.0'
    implementation 'com.tealium:kotlin-collect-dispatcher:1.1.1'

maybe something conflicts?
jameskeith commented 11 months ago

@giovanniPolatoO thanks for that - It's certainly possible that there's a conflict during resolution, and it's a little odd to see that there's no version specified for com.tealium:kotlin-core Nevertheless, I've copied those dependencies into my test application but it correctly resolves to v1.2.1 of the TagManagement Dispatcher and the crash is therefore still not reproducible at my end.

Are you able to reproduce this at your end, or is it a report from users? Are you able to confirm whether or not this may be from a previous release of the app?

giovanniPolatoO commented 11 months ago

Sorry, I also implement com.tealium:kotlin-core:1.5.5

Unfortunately, I cannot reproduce the bug on my device. However, all the reports received from crashlitics are from users who always have Android GO as their operating system

jameskeith commented 11 months ago

@giovanniPolatoO Sorry to keep asking it, but is it possible that these crashes have come from an older app release? that had older Tealium versions?

I'm pretty confident that these crashes are resolved in the latest releases, and that the crash in question has come from an older version of our AAR's. It's pretty difficult to say for sure without knowing anything about the app itself, what it's release history is; what versions of Tealium have been published into the apk etc.

I don't have an Android GO device to hand, but the documentation doesn't specify that WebView is disabled by default: https://developer.android.com/guide/topics/androidgo#differences-from-android