Cordova Windows Installation Checklist (Android)

If you are installing cordova for the first time, here is a checklist of things that need to be done to install it on Windows (I tested this with 7 and 8), as well as prepare it for building android apps. Let's dive right in.

  1. Install nodejs. This will be used to run the cordova commands from the CLI.

  2. Install Java JDK for compiling the android code.

  3. Install Apache Ant, used for building the required packages.

  4. Install Android Studio with Android SDK. Important for getting the necessary android components. This will also allow us to debug the solution on an android emulator and device eventually.

  5. Install git. This may be required when installing some of the cordova plugins, so it makes sense to prepare it as well.

  6. Download and install OpenSSL. Get the 64-bit version. OpenSSL will be used to read the app's key hash when it comes to releasing your app later on.

  7. In order for all the installed software to work, the correct environment variables need to be set up. This is done by opening the control panel and in the 'Search Control Panel' field type 'advanced system settings':

    Click the 'view advanced system settings' option. Then click the 'environment variables' button:

    Then we need to add some new variables: (The values in the table below are the default paths where each one of the files that we downloaded were installed. If you chose a different folder you will need to change the path values. For 32-bit machines in particular, you will need to remove the (x86) from the program files path, and the java version (jdk1.8.0_11) is also bound to change by the time this is published.

    Add the following variables:

    ANDROID_HOMEC:\Program Files (x86)\Android\android-studio\sdk
    ANDROID_PLATFORM_TOOLSC:\Program Files (x86)\Android\android-studio\sdk\platform-tools
    ANDROID_SDK_ROOTC:\Program Files (x86)\Android\android-studio\sdk
    ANDROID_TOOLSC:\Program Files (x86)\Android\android-studio\sdk\tools
    JAVA_HOMEC:\Program Files\Java\jdk1.8.0_11
  8. Next, still in the environment settings, select the Path variable and click the edit button to add the following paths to the Path variable: C:\Program Files\nodejs\;C:\ant\bin;C:\Program Files (x86)\Android\android-studio\sdk;C:\Program Files (x86)\Android\android-studio\sdk\platform-tools;C:\Program Files (x86)\Android\android-studio\sdk\tools;C:\OpenSSL\bin

  9. Now we are ready to dive into the command prompt, so go ahead and open it. type

    >ant -f fetch.xml -Ddest=system

    and press the enter button. This will make sure that ant will fetch the latest dependency information. If it does not work, i.e. cannot find ant, recheck the environment variables above. It is absolutely important that those variables are set properly at this point.

  10. The last thing to install is cordova itself. Using the npm package manager, run the following command:

    >npm install -g cordova

That should be everything, but at this point it would be nice to see something working on an actual android device. Luckily the default cordova application just does that. With cordova installed, let's run some more commands in the same command prompt window.

  • First create a new project. We need to give it a name, a unique identifier, and choose a folder to store it to:

    >cordova create FOLDERNAME com.yoururl.appname AppTitle

  • Change directory to the newly created folder:


  • Tell cordova that we want to support the android platform:

    >cordova platform add android

  • With the device connected to your computer run:

    >cordova run android

  • Alternatively we can use the android emulator to test, but we haven't set that one up yet. That is for another day, but if you happen to have an emulator running, type:

    >cordiva emulate android

If everything went well, you should see the image at the top of this page on your device.

Buy me a coffee Buy me a coffee


Add your comments