5

I have an Android 5.1 device, where I have full root access. For this device I have written a cordova application and installed it as a system app. It is working good, however the webview-version of Android 5.1 is very old and unfortunately has a few bugs.

I know that you can update the webview with the playstore, but unfortunately the device does not have the google apps and therefore I am not able to update the webview with the playstore.

So my question is: How can I update the system webview without google playstore?

I already tried it with a rather naive approach, which unfortunately killed my application:

I have downloaded the latest webview.apk from the playstore (https://play.google.com/store/apps/details?id=com.google.android.webview&hl=de)

Then I did:

adb remount
adb push webview.apk /system/webview/
adb reboot

Now I get errors when I try to start my cordova application and the app itself doesn't show up anymore:

I/CordovaActivity( 1931): Apache Cordova native platform version 6.1.1 is starting
D/CordovaActivity( 1931): CordovaActivity.onCreate()
E/WebViewFactory( 1931): Failed to list WebView package libraries for loadNativeLibrary
E/WebViewFactory( 1931): android.content.pm.PackageManager$NameNotFoundException: com.android.webview
E/WebViewFactory( 1931):        at android.app.ApplicationPackageManager.getApplicationInfo(ApplicationPackageManager.java:281)
E/WebViewFactory( 1931):        at android.webkit.WebViewFactory.getWebViewNativeLibraryPaths(WebViewFactory.java:282)
E/WebViewFactory( 1931):        at android.webkit.WebViewFactory.loadNativeLibrary(WebViewFactory.java:397)
E/WebViewFactory( 1931):        at android.webkit.WebViewFactory.getProvider(WebViewFactory.java:103)
E/WebViewFactory( 1931):        at android.webkit.WebView.getFactory(WebView.java:2194)
E/WebViewFactory( 1931):        at android.webkit.WebView.ensureProviderCreated(WebView.java:2189)
E/WebViewFactory( 1931):        at android.webkit.WebView.setOverScrollMode(WebView.java:2248)
E/WebViewFactory( 1931):        at android.view.View.<init>(View.java:3595)
E/WebViewFactory( 1931):        at android.view.View.<init>(View.java:3689)

How is the correct way to update the webview.apk without google playstore?

  • Download latest webview.apk from www.apkmirror.com – Једноруки Крстивоје Jan 10 '17 at 10:52
  • I already have the apk... the problem is how to install it – Michael B Jan 10 '17 at 11:36
  • Don't forget to reboot after replacing a system .apk, so the Dalvik cache gets rebuilt (remember that "updating apps…" hint on first boot?). – Izzy Jan 10 '17 at 12:33
  • Yes I made a reboot - it also says so in the question. "adb reboot" – Michael B Jan 10 '17 at 15:05
4

The Google WebView application is very different from regular ones. You cannot use Package Installer to install or update it in a common way. You must do it yourself (As for my Lollipop 5.1.1).
Here's the way I've done it several times. Run in a root shell. You may need busybox for unzip (or do it with a file manager).

#!/system/bin/sh
rm -r /data/app/com.google.android.webview*
mkdir /data/app/com.google.android.webview-1
cd /data/app/com.google.android.webview-1
cp /path/to/your/webview.apk ./base.apk
unzip base.apk 'lib/armeabi-v7a'
mv lib/armeabi-v7a lib/arm
# Do the following 2 lines only if you're on an ARM64 ROM
unzip base.apk 'lib/arm64-v8a'
mv lib/arm64-v8a lib/arm
#
find . -type f -exec chmod 644 {} +
find . -type d -exec chmod 755 {} +
find . -exec chown 1000.1000 {} +

Alternatively, you can try creating directory /system/priv-app/WebView and put the new APK there. Remember to get rid of the old one.

1

You try to update "com.google.android.webview", but your system uses "com.android.webview" version.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.