Richard Lovejoy
Richard Lovejoy

Reputation: 663

Cordova not using the latest Android System Webview

I may have found an answer to the problem here, but was wondering if there is any more recent info.

I have a simple 'hello world' cordova app where I check the version of the webview via navigator.userAgent as well as with the cordova-plugin-webview-checker. (Android 5.1.1)

The userAgent is coming back showing a really old version of Chrome (39):

navigator Mozilla/5.0 (Linux; Android 5.1.1; rk3288 Build/LMY48Y) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/39.0.0.0 Safari/537.36

However, the webview checker thinks I'm using the most recent version, > 72. I have the latest 'Android System Webview' installed on my device.

After doing some research, it appears the problem stems from the Android device being 'hardcoded' to access the webview from com.android.webview instead of com.google.android.webview, which is where it needs to go to find the latest installed version.

If this is indeed the problem, the question is what is the most painless way to resolve this? I couldn't find many example of the problem and Cordova doesn't seem to have an official workaround for this.

Thanks

Upvotes: 2

Views: 3804

Answers (1)

Morrison Chang
Morrison Chang

Reputation: 12121

For using a recent WebView engine on Android and you can't use Android System WebView or Google Chrome:

Prior to Android 5.0 improvements to the Android WebView was limited to OS upgrades/updates. So the recommendation was to use the NOW DEPRECATED Crosswalk Project as the WebView. While the site no longer exists, its ghost exists on archive.org I don't know if enough of the site survives there to be useful. This might be a solution if you are unable to change hardware and need more recent webkit features.

As the Crosswalk Project is no longer updated, or it doesn't have the features you need, I've learned that Mozilla has a GeckoView which wraps their Gecko render engine.

Note that according to Mozilla's documentation they have their own APIs so are NOT a drop-in replacement for Android's WebView, so some effort must be made to integrate into Cordova.

Upvotes: 2

Related Questions