It's likely that this is happening in the very short time frame immediately after Lollipop's Android System WebView application updates.
I'd seen this error in the Google Play Dev Console, but also had never been able to reproduce it on my Nexus 5, regardless of how much I really tried to stop my app from having access to the Android System WebView app:
java.lang.RuntimeException: Unable to create application com.uninteresting.app.name:
android.util.AndroidRuntimeException: android.content.pm.PackageManager$NameNotFoundException: com.google.android.webview
Then we got word that our app was consistently crashing with the above message on some devices immediately after the System WebView app updates, so I tested that. Still no results, the vanilla Nexus 5 refused to crash our app! So I tried other phones from other manufacturers (roughly 75% of our reports are from Samsung Galaxy devices) and suddenly we were crashing consistently. My testing methodology:
A few little caveats with what I've said so far:
In short, I don't immediately think you're doing anything incorrect with ProGuard or your JavascriptInterface. I'm leaning very strongly toward blaming the firmware as the root cause of the majority of reports, resulting in what should be a smooth update process becoming one that instead causes some apps to outright crash.
Edit: I ran a few more tests and it turns out that all the devices that didn't crash are 5.0 or 5.0.1, while all the devices that did crash were 5.0.2, so I can't comfortably point my finger at OEMs anymore.
Easy way to check with androidx.webkit library:
dependencies {
...
implementation 'androidx.webkit:webkit:1.4.0'
}
Use WebViewCompat.getCurrentWebViewPackage method before (for example, ads):
val webViewPackageInfo = WebViewCompat.getCurrentWebViewPackage(appContext)
Timber.d("📦 web view package info: %s", webViewPackageInfo?.toString())
val isWebViewPackageAvailable = webViewPackageInfo != null
prepareWithAds(canPlayAds = isWebViewPackageAvailable)
Steps for reproduce:
adb root
adb shell pm uninstall -k --user 0 com.google.android.webview
E/WebViewFactory: Chromium WebView package does not exist android.webkit.WebViewFactory$MissingWebViewPackageException: Failed to load WebView provider: No WebView installed
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With