How to replace WebView on Android devices
Webview replacements can fail, and it is advisable to have physical access to the device to repair it!
With the 2.x version of the Wallboard application, we started to use Google's WebView. This guide shows you how to replace the WebView on your Android device remotely through the Editor. Devices with outdated WebView version can malfunction.
You can check the WebView version of your device in the Screen info. We recommend replacing the WebView under version 60.
Can I update/replace webview on my device?
Android platform is large and we cannot say if a given device will be able to go through with the webview replace/update. Below are some rule of thumb pointers on what to look out for.
- WebView replace / update requires rooted devices. If the device is not rooted the update/ replace will not work.
- You will not be able to replace/update webview version on the following platforms:
- Qbic
- Philips
- Vestel
- Sony
- Custom build provided by the vendors may prevent update/replacement to go through
Replace webview
Make sure the device has stable internet connection before starting the process. Otherwise, webview replace/update will fail!
Error in REPLACE_SYSTEM_WEB_VIE_INITIAL! Reason: Unable to download System WebView application
To replace the WebView you need to send a command to the device from the editor.
Right click on the desired screen and go to Manage screens > Send command
Input one of the following command to the input field and press Send button.
Version 3.0.x and up
Download the webview.apk from the CMS server and replaces the Android system WebView
Make sure to check which WebView(System/Chromium/Google) your device uses before sending the command. You can check your WebView version by right clicking the screen in the editor and going to Screen info > Other section.
You can use the following command to update the System WebView without manually downloading and hosting the webview apk yourself.
{"user_command":"ReplaceWebView", "command_data":{"type":"SYSTEM_WEB_VIEW"}}
The devices will download the WebView from the server which they are connected to.
If there is no webview.apk uploaded to your server by us then the device will not update the WebView. In this case please contact support@wallboard.info.
Command to download the apk from the given URL and replace the Chromium WebView:
{"user_command":"ReplaceWebView", "command_data":{"type":"CHROME", "url":"[APK_URL]"}}
Command to download the apk from the given URL and replace the Google system WebView:
{"user_command":"ReplaceWebView", "command_data":{"type":"GOOGLE_SYSTEM_WEB_VIEW", "url":"[APK_URL]"}}
Your device will now download the new WebView. Once the download is complete the device will reboot.
Version 2.21.06.x and before
{ "user_command" : "ReplaceWebView" }
When the device reboots it will change the WebView and will reboot again.
How to repair device after WebView replace failed?
If the WebView replace failed on your device then you have to follow these steps:
Repair WebView locally through ADB
-
Open a command prompt on your PC, and connect to your device via ADB. (https://developer.android.com/studio/command-line/adb/)
-
Once you are connected, use the
adb shell
command to access the terminal on your device. -
First, type
su
to have superuser privileges. -
Remount the device's system partition with the
mount -o rw,remount / system
command (If your device's Android version is 9.0 or higher then use this command:mount -o rw,remount /
) -
Then move to the WebView application folder
cd /system/app
-
Here check if there is a folder called WebView
ls -l
. -
If you find the WebView folder then remove it
rm -rf webview
. Now the WebView is permanently deleted from the device. -
Download the latest WebView application from here: https://www.bromite.org/
-
Exit from the shell with the
exit
command (sometimes you have to use it twice to exit fully), and install the downloaded WebView application withadb install <path of your downloaded apk>
. -
Open the shell again (2. And 3. step), and find the installed application's folder
cd /data/app/
, and if the install was successful then thecom.android.webview
folder will be there. -
Remount the device's system partition with the
mount -o rw,remount /system
command (If your device's Android version is 9.0 or higher then use this command:mount -o rw,remount /
) -
Go to the
/system/app
folder and move the installed webview application from the/data/app
folder to the/system/app
folder withmv /data/app/<your webview>/system/app
-
Rename the folder to webview
mv <old directory name (which you have just moved here in the previous step)> webview
and set its owner and group to root, and its permission to 755chown -R root:root webview/,chmod -R 755 webview/
-
Move into the WebView folder with the
cd webview
command, and rename the .apk file to apkmv <old apk name> webview.apk
and set its permissions to 644.chmod 644 webview.apk
-
Reboot your device.
-
After the reboot clear the application data.
Settings > Apps > <Your app name> > Clear data
Repair WebView remotely with Terminal Emulator
-
Download Terminal Emulator software to your computer
-
Connect to the device remotely with TeamViewer for example
-
Copy the Terminal Emulator installer apk to the storage of the device
-
Install Terminal Emulator and open it
-
First, type
su
to have superuser privileges. -
Remount the device's system partition with the
mount -o rw,remount / system
command (If your device's Android version is 9.0 or higher then use this command:mount -o rw,remount /
) -
Then move to the WebView application folder
cd /system/app
-
Here check if there is a folder called WebView
ls -l
. -
If you find the WebView folder then remove it
rm -rf webview
. Now the WebView is permanently deleted from the device.
-
Download the latest WebView application from here: https://www.bromite.org/ (arm64/arm/x86_SystemWebView.apk based on the device architecture)
-
Copy the WebView installer apk to the storage of the device
-
In Terminal Emulator
-
Install the downloaded WebView application with
pm install <path of your downloaded apk>
. -
Open the shell again (2. And 3. step), and find the installed application's folder
cd /data/app/
, and if the install was successful then thecom.android.webview
folder will be there. -
Remount the device's system partition with the
mount -o rw,remount /system
command (If your device's Android version is 9.0 or higher then use this command:mount -o rw,remount /
) -
Go to the
/system/app
folder and move the installed webview application from the/data/app
folder to the/system/app
folder withmv /data/app/<your webview>/system/app
-
Rename the folder to webview
mv <old directory name (which you have just moved here in the previous step)> webview
and set its owner and group to root, and its permission to 755chown -R root:root webview/,chmod -R 755 webview/
-
Move into the WebView folder with the
cd webview
command, and rename the .apk file to apkmv <old apk name> webview.apk
and set its permissions to 644.chmod 644 webview.apk
-
Reboot your device
-
After the reboot clear the application data.
Settings > Apps > <Your app name> > Clear data
If all the steps are done correctly then if you start the application it will start normally.