NameNotFoundException webview NameNotFoundException webview android android

NameNotFoundException webview


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:

  1. Open your app, make sure a WebView is showing.
  2. Open Play Store, navigate to "My Apps," and bring up "Android SystemWebView." Uninstall updates. This shouldn't crash you, but youshould see your app force-restart.
  3. Open your app back up and let it recover from the restart.
  4. Go back into the Play Store and update Android System WebView.
  5. Re-focus your app during the update process. Now, if you're on anaffected device, it should crash. If not, your app will just bepushed to the background and quietly restarted.

A few little caveats with what I've said so far:

  • Our app makes the mistake of starting up a WebView extremely early, hence why we get "unable to create application" in our crash message. The user doesn't even have to be looking at our app for it to crash. I doubt this applies to you, but if your app attempts to restart its activity containing a WebView during this scenario, that would explain it.
  • 100% of our reports are from 5.0 devices, I have no earthly clue how this could occur on anything below Lollipop.
  • We do see reports of Nexus 4 and Nexus 5 with this error, so I don't know why I can't reproduce it on those devices. Might be a separate root cause, but I need to look further into that.

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.


This happens when chrome updates on android: during the update, the package does not count as installed and so attempts to look it up in the package manager will fail.

For my case it persisted for awhile longer (the app kept crashing) until I actually reboot / restart the device, then all is well.

There is nothing wrong with your code, its just how updates are handled.

Source: https://bugs.chromium.org/p/chromium/issues/detail?id=506369


I found a way to reproduce the problem (htc one (m8) android 6.0).
In my app I use Android System WebView component at start (in Activity.onCreate() method). I know that this is bad practice, but this is only for example.

Steps:

  1. open Google Play and remove updates of the Android SystemWebView
  2. launch your app
  3. go back to Google Play and launchinstalling updates of the Android System WebView and quicklyreturn back to your app and waiting for your app is closed
  4. repeatstep 1 and quickly return back to your app
  5. you will see error report
  6. sorry for my english...