General guidelines and suggestions for quickly getting started with the development of Apache Cordova apps for either Android, iOS and Windows.
Choosing the right IDE for Cordova apps
Android Studio by Google
Not recommended. Android Studio features 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 Apache NetBeans IDE 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 (signed) app builds.
- Powerful IDE that works with all cordova and cordova-android versions with minor tweaks
- Easy to mantain and edit HTML, JS, CSS, Java and other languages code
- Can deploy apps directly to Android device and emulators
- Regularly mantained and updated by the Apache Software Foundation
Microsoft Visual Studio with Tools for Apache Cordova
Visual Studio up to 2017 features the VS Tools for Apache Cordova toolset that adds support for creating, compiling and debugging Cordova apps for either Android and Windows easily. VS 2017 features some drawbacks compared to VS 2015 regarding Cordova apps development.
- Can compile and debug Windows 10 / Universal apps with the cordova-windows platform
- Incompatible with cordova@9, works relatively fine up to [email protected]
- Incompatible with Android platform versions newer than [email protected]
- Visual Studio 2015 seems to be less problematic than 2017 for Cordova apps
- Visual Studio 2019 lacks the Cordova Toolset entirely
- Outdated support for building iOS apps
Installing Android SDK and emulators
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
Accept Android SDK License
Follow these steps to accept the Android SDK license agreement, otherwise you’ll get this error on build time: Failed to install the following Android SDK packages as some licences have not been accepted.
Add the Android path to your environment variables
Create an ANDROID_HOME System Variable with the path to your Android SDK, such as C:\Users\Username\AppData\Local\android-sdk. You can use Rapid Environment Editor instead of the rudimentary Windows environment variable editor.
Updating the Android SDK emulators
Update the Android SDK emulators as explained in that post, otherwise you won’t be able to emulate Android 8 and newer devices due to an incompatibility with the previous version.
Download SDK and system images
Open the Android SDK Manager and download some SDKs and system images and tools like the ones shown here:
Proceed to install NodeJS. Please note that the required version depends on your Cordova CLI version. For Cordova CLI 10, the minimum required NodeJS version was raised to 10.x. For previous CLI versions you can use NodeJS 6.x.
To ensure plugins compatibility, install Gradle with the linked instructions. Your Gradle version selection depends on the Cordova CLI and cordova-android platform version used.
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 9.0.0, 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 Cordova, Node & Gradle versions
Below you can see the versions intalled for using Cordova 8.1.2 alongside Visual Studio 2015.
Add the cordova-android platform
To add the latest supported cordova-android platform, type this command:
cordova platform add android
To install a previous cordova-android version, make sure it’s compatible with the desired API first by checking the API levels table:
To install an older version such as cordova-android 6.4.0 (for Android API 16) use this command:
cordova platform add [email protected]
For NetBeans IDE developers
The NetBeans IDE will 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.
For Visual Studio IDE developers
Visual Studio 2015/2017 includes 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:
Notice that Visual Studio 2019 does not include Cordova support at all because no toolset has been released for it.
The content in this post is for general information purposes only. The information is provided by the author and/or external sources and while we endeavour to keep the information up to date and correct, we make no representations or warranties of any kind, express or implied, about the completeness, accuracy, reliability, suitability or availability with respect to the website or the information, products, services, or related graphics contained on the post for any purpose. Some of the content and images used in this post may be copyrighted by their respective owners. The use of such materials is intended to be for educational and informational purposes only, and is not intended to infringe on the copyrights of any individuals or entities. If you believe that any content or images used here violate your copyright, please contact us and we will take appropriate measures to remove or attribute the material in question.