Upgrading to Cordova 11

Cordova 11 was recently released. It includes updates to several of the Cordova libraries, including cordova-android 10.1.1 and cordova-ios 6.2.0.

VoltBuilder Android users may need to do some upgrades. Both Cordova and Google have made updates which may require changes to your config.xml or your code. Updating to Cordova 11 will allow your projects to use Android API 30, which has been required for new projects since November 1, 2021.

For iOS, the changes are minor - you’re unlikely to notice any difference.

In most cases, these changes are long overdue. Instead of using out of date or deprecated code, you now need to fix it.

We’ve looked a dozens of actual projects to make a list of common changes. If you have additional tips, please send them to support@volt.build.

Here’s a step by step guide to updating your project.

Set your engine

Cordova 11 uses an updated engine for Android. Until Cordova 11 is the default, you will need to set it in your config.xml file:

<engine name="android" spec="10.1.2" />

Get rid of the whitelist plugin

The whitelist plugin is now automatically included by Cordova in your Android build, so there is no need to have it in your config.xml. (It was never needed for iOS.)

To avoid build errors, get rid of this line:

<plugin name="cordova-plugin-whitelist" />

package android.support.v4.content does not exist

In 2018, with Android 9, Google replaced the Android Support Library with AndroidX. Since then, Cordova (and VoltBuilder) have supported both libraries. Starting with Cordova 11, only AndroidX is supported.

Plugins which were written using the Android Support Library need changes to use AndroidX. Many of the maintainers of the plugin have upgraded them already. If so, they will work fine.

If not, there is a plugin which will do the conversion automatically as part of your VoltBuilder build. Add this line to your config.xml:

<plugin name="cordova-plugin-androidx-adapter" />

Make sure your plugins are up to date

Look up each of your plugins on npm. Make sure they are up to date. Here are a couple of common ones which need updating:


Get rid of cordova-plugin-file-transfer (and variations)

Early in Cordova’s existence, the file-transfer plugin was created to solve the problem of downloading binary files. By 2017, JavaScript’s XMLHttpRequest was able to do all the some stuff, so it became obsolete. For almost 5 years, Cordova has continued to support it. With Cordova 11, it is time to update your code.

Here’s an article which explains transition off of cordova-plugin-file-transfer.

The following plugins need to be removed from your project (there may be others):


Use the right Android SDK version

You may have a line like this in your config.xml, which specifies which version of the Android SDK you want to use.

<preference name="android-targetSdkVersion" value="28" />

With Cordova 11, supported values are currently 28 through 31. You’ll get an error if your value is outside that range.

Using the old cordova-android with Cordova 11

If you can’t fix all the problems, it’s still possible to use Cordova 11. Add this line to your config.xml:

<engine name="android" spec="9.1.0" />

This will drop back to the old version of cordova-android. It’s not a permanent solution - you should will work on fixing the problems and getting your project up to date.


Check out the Troubleshooting page.

For more, check out Support page.