DISCOVER
X

Cordova Installation in Windows 8 Part 1

August 28, 2014 10:52 pm Leave your thoughts
FacebooktwitterredditpinterestlinkedinmailFacebooktwitterredditpinterestlinkedinmail

Contributed by Arthur K

In my pursuit to further my experiences in the software development world, I have dived into the interesting world of Cordova. The concept is quite simple, build applications using JavaScript and use Cordova to convert them into native applications in various mobile platform. This means that as a developer we do not have to learn every single mobile programming languages in depth, instead we can focus our efforts on Javascript, CSS and HTML.

In this tutorial, I am going to show you how to prepare Windows 8 for building Android applications using Cordova and Android Studio. This is important as personally it took me a while to collate the correct information until everything finally run well.

We will talk about the following:

  • Node JS
  • Cordova
  • Apache And
  • Java SDK
  • Preparing your first Android app

Node JS

First, download node-v0.10.31-x86.msi installation file from the website. When installing node, notice that the installer is trying to add node to the PATH environment. Make sure it is ticked as yes or install as this will allow you to access node directly from the command prompt later on.

Download Node JS at: http://nodejs.org/download/

cordova_setup1

After the installation has finished, test if node was installed correctly by typing “node –v” into your command prompt. You should get the version number that you are on now, in this case it will be v0.10.31. A successful installation means that npm, which is the package manager of node.js will be automatically installed too. You can confirm this by typing “npm –v” to check its version.

Cordova

Next step would be to install Cordova through npm by typing “npm install –g cordova”. This command will install cordova globally (-g) on your machine.

Confirm that installation was successful by typing cordova -v on command prompt to see what version installed, in this case it would be 3.5.0-0.2.7.

Java

Now that we have Cordova installed in our machine, it is time to work on JDK installation. It is possible that your computer already have the Java previously, especially if you have developed on this machine beforehand.

Type “java –version” to check whether you have Java installed. If not, go ahead and download JDK, currently Java SE Development Kit 8u20, from the Oracle site below.

Follow the installation steps, then redo the checking again by running “java –version”, via command prompt to see whether Java is installed properly.

If after JDK installation, “java –version” returned an error instead of installed version number, you would need to add environment PATH for windows to recognise the “java” command. In order to add to the PATH, you need to follow steps below:

  1. Right click on windows start bar at desktop
  2. Select “System”
  3. Select “Advance system settings” on the left bar
  4. Click “Environment Variables…”, the button near the bottom of the popup windowcordova_setup2
  5. Add new entry on the System variables as follow
    Name  : JAVA_HOME
    Value : C:\Program Files\Java\jdk1.8.0_11
    Browse the directory until you can see “bin” directory.cordova_setup3
  6. Append on your PATH User variables for <Username> using the following values.Value : (your existing Value for PATH);%JAVA_HOME%\bin;

    It is important not to delete or modify your previous PATH value and only append and use “;” as separator from your existing previous PATH value.The JAVA_HOME will call the System variable and the combined line should be:C:\Program Files\Java\jdk1.8.0_11\binWhich is the installation directory of your JDK. Further modification of the JAVA_HOME will needed if you install a new JDK version in the future.
  7. Double check in the command prompt to see if you have setup everything successfully. Running “java -v” should get you the version number.

Jump to part 2: Apache installation and preparing your very first Cordova application.

FacebooktwitterredditpinterestlinkedinmailFacebooktwitterredditpinterestlinkedinmail
Tags: , ,

Categorised in: , , ,