This answer simply expands on Noel De Martin one, as i encountered several troubles getting the apk version and actually installing it.
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
while 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
In case you get an "emulator not found" error on the first step, you probably need to add various android variable to your path, I used an inspiration from this question (my path were different as I am on wsl, and I added the soruce command in my .bashrc
file)
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).
To download an apk from google source, I had to find the proper apk I needed, on https://android.googlesource.com/platform/external/chromium-webview/+log, searching in the commit messages for my version.
After that, I needed to find my emulator version, for which https://mcmap.net/q/209931/-how-to-find-arm-processor-version-on-android-device gave me the answer.
Finally, to actually download the apk, I needed to use the tgz link on a folder from google git (as shown on this screenshot : ). Indeed, I found no other way to download the apk.
Hope it helps someone.