This document describes how to install Apache Cordova and the Android SDK on a Windows machine. This is a quite complex process, which may take some time depending on your previous experience with installing SKDs and build tools. Care has been taken when writing this document to include all the essential steps needed to get you up and running with a successful install. Kindly let us know if there is something you are missing (email: firstname.lastname@example.org).
To develop Android apps, you need to install the Android SDK, and also Java if not already installed on your machine.
For the Android SDK, you have the choice between installing Android Studio or just the Android SDK Tools (sdkmanager).
Follow these steps to install Cordova:
- Install Node.js. Cordova runs on the Node.js platform, which needs to be installed as the first step. Download installer from: http://nodejs.org
- Go ahead an run the downloaded installation file. It is recommended to use the default settings. Node.js needs to be added to the PATH environment variable, which is done by default.
- To test the installation, open a command window (make sure you open a new command window to get the updated path settings made by the Node.js installation), and type:
If the version number is displayed, Node.js is installed and working!
- Install Git. Git is a version control system, which is used by Cordova behind-the-scenes. Download and install from: http://git-scm.com. Default settings are recommended.
- Install Cordova. Cordova is installed using the Node Package Manager (npm). Type the following in the command window to install:
npm install -g cordova
- Test the Cordova install by typing:
If you see the version number, you have successfully installed Apache Cordova!
The Android SDK needs the Java Development Kit (JDK) to be installed, version 1.7 or later. Note that the Java Runtime Environment (JRE) is not sufficient, you will need the JDK. To check if you have the JDK installed already, type this on the command line:
If you do not have the JDK installed, proceed as follows:
- Download the recent version of Java SE JDK (SE = Standard Edition) from Oracle: www.oracle.com/technetwork/java/javase/downloads/. Click the Java SE Download to see the list of downloads. Get the “Windows x86” download if you have 32-bit Windows, and “Windows x64” if you have 64-bit Windows. If you do not know which version you have, find out using the Control Panel by selecting “System and Security” and then “System”, where you will find the “System type” saying if your Windows version is 32-bit or 64-bit.
- Go along and run the downloaded installer file. Using the default selections should be fine, but take a note of the directory in which you install the JDK. You will need to add this to the PATH in a later step below.
- Next, update your path to include the JDK. Open the Control Panel, click System and Security, click System, click Change settings, which will open the System Properties window. Select the Advancedtab, then click the Environment Variables button.
- In the list User variables select PATH and click the Edit button. (If there is no PATH entry in the list, click the New button to create one.)
- At the end of the field Variable value, add a semicolon followed by the path to the bin directory of the JDK install. Here is an example (note that this must be the actual path used for the install on your machine):
An easy way to do this is to prepare the path to add in a text editor, then paste it at the end of the input field. When done click the OK button.
- Next add the JAVA_HOME variable if it is not present (and if it is in the list, you may need to update its value using the Edit button). Click the New button. In the field Variable name type:
In the field Variable value enter the path to the directory where the JDK is installed, without the semicolon and the /bin subdirectory, for example:
Click the OK button.
- Click the OK button again to close the Environment Variables window.
- Now you are ready to test the install. Close any open command windows, and open a new command window and type:
If you see a version number you are done with the JDK install!
If you get stuck
If you get stuck, consult the documentation at the respective web sites for Cordova, Java, and Android. The Cordova documentation has a platform guide for Android. You are also welcome to ask for help at the Evothings Forum.
One thing to do is to inspect all the environment variables. You can do this from a command window (note that you have to open a new command window after updating environment variables for updated values to be available). This displays the system PATH:
Here is how to inspect the value of JAVA_HOME:
The fun begins
Next step is to create and build a Cordova project. Go to the Cordova Guide to learn more.