This post intents to provide the general guidelines to setup your environment to develop Apache Cordova apps for either Android or Windows.
Choosing the right IDE for Cordova apps
Not recommended. Android Studio includes no Cordova-related support whatsoever, but this does not mean you cannot use it. However it will increase the complexity of your Cordova apps development rather than making it easier. You’ll need to use the CLI (command line interface) to build and deploy your apps manually.
The NetBeans IDE 8.2 includes sample getting started apps, however it must be tweaked to properly manage plugins. NetBeans is a powerful and intuitive IDE that makes it easier to manage Cordova apps, but you’ll still need to use the CLI anyway from time to time, such as to compile Release builds.
Visual Studio up to 2017
Visual Studio up to 2017 feature the VS Tools for Apache Cordova toolset that adds support for creating, compiling and debugging Cordova apps for either Android and Windows really easy. 2017 features some drawbacks compared to VS 2015 in Cordova apps development.
You may employ any other IDE regardless of its lack of Cordova support. In this case you can compile, debug and deploy with the CLI commands.
Installing the required stuff for Cordova
Install Android SDK
The last release of the standalone Android SDK installer is 24.4.1 and can be downloaded from:
- Windows: android-sdk_r24.4.1-windows.zip
- Installer version: installer_r24.4.1-windows.exe
- MacOS: android-sdk_r24.4.1-macosx.zip
- Linux: android-sdk_r24.4.1-linux.tgz
Updating the Android SDK emulators
Update the Android SDK emulators to version 27.3.8, otherwise you won’t be able to emulate Android 8 devices and newer:
- Windows: emulator-windows-4848055.zip
- MacOS: emulator-darwin-4848055.zip
- Linux: emulator-linux-4848055.zip
Extract the contents from the ZIP file into your android-sdk/tools:
- Windows: The ZIP file contains a tools folder that must be copied over your current android-sdk/tools folder.
- MacOS: The ZIP contains an emulator folder that must be merged with your android-sdk/tools folder. Do not use the
Apply to all foldersoption when copying contents from the ZIP to the tools dir
Download SDK and system images
Open the Android SDK Manager and download some SDKs and system images and tools like the ones shown here:
Install NodeJS 6.x
Proceed to install NodeJS 6.x. Please note that installing a version newer (or older) than 6.x could result in several build errors.
Install Gradle 4.10.x
To ensure plugins compatibility, install Gradle 4.10.x with the linked instructions. You may install a newer version at your own risk, however the newer the version the more likely to get gradle-related build errors later on.
Install Cordova CLI
To install the latest Cordova version, open a command prompt and run:
npm install -g cordova
To install a previous version such as 8.1.2, use this command instead:
npm install -g [email protected]
After this process is ready your environment will be ready to start creating Apache Cordova apps with your preferred IDE and/or the command line interface.
Check components version
Below you can see the versions intalled for using Cordova 8.1.2 alongside Visual Studio 2015.
Warning for NetBeans IDE developers
NetBeans require certain tweaking in order to avoid problems with the Cordova plugins. The built-in plugins manager will fail to install any plugin whatsoever, so you should avoid it by following these NetBeans-specific instructions.
Warning for Visual Studio developers
Visual Studio 2015/2017 include very outdated Android SDK and Cordova CLI toolsets, but you can use your own SDK version by setting the ANDROID_HOME value to your external Android SDK previously installed:
By applying certain fixes shown here, you can use [email protected] alongside Visual Studio 2015/2017 to create, debug and deploy Android apps with the built-in VS commands. Unfortunately you cannot use [email protected] or newer with Visual Studio due to the Apache team changing cordova’s internal file structure constantly between versions, instead of using a persistent file arrangement.
Notice that Visual Studio 2019 does not include Cordova support at all because no cordova toolset has been released for it.