Android 5.0.0 running in emulator appears to not take Web View updates. That is, Android System Webview installs just fine from the Play Store (link). However, the browser continues to use the older stock WebView (according to the user-agent string).
Why isn't webview upgrading in the emulator and how can it be done?
P.S. The upgrade appears installed alongside the stock WebView (both show up in the list of applications). Tried installing via Play Store and manually to no avail.
P.P.S. The purpose of this is to test how my code handles a particular bug in a certain version of webview.
5 year old question, and yet I found it yesterday and got to solve it after some tinkering.
First, as to why installing the webview from the play store doesn't work, that is answered in this question. In a nutshell, the emulator is using com.android.webview
whilst google play installs com.google.android.webview
. And there is no way (that I know of) to configure the emulator to use Google's webview. So using the play store is a dead end.
What I could achieve though is uninstall the default webview and install a newer version. I wasn't able to just upgrade it because the apk I got for the new webview had a different signature from the one installed. But uninstalling isn't straightforward either, because the webview is a system app and you won't be able to uninstall it running adb uninstall
.
Here's what I did:
# Boot the emulator in write mode and make /system writable
emulator @DeviceName -writable-system
adb remount
# Uninstall the webview app manually and reboot the device
adb shell
rm -rf /data/data/com.android.webview
rm -rf /system/app/webview
reboot
# Install the new version
adb install webview.apk
One drawback of this approach is that you'll need to boot your device in write mode for subsequent runs (no need to run adb remount
again though). But it works!
In case you're wondering, I got the apk for the new version from Google's source (no need to compile manually).
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