Cordova Installation in Windows 8 Part 1
August 28, 2014 10:52 pm Leave your thoughtsContributed 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/
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.
1 2 3 4 |
// check node version node -v // check npm version npm -v |
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.
1 2 3 4 |
// install cordova npm install -g cordova C:\Users\<Username>\AppData\Roaming\npm\cordova -> C:\Users\<Username>\AppData\Roaming\npm\node_modules\cordova\bin\cordova … |
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.
1 2 3 |
// check cordova version cordova –v 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.
1 2 |
Download JDK 8 http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html |
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:
- Right click on windows start bar at desktop
- Select “System”
- Select “Advance system settings” on the left bar
- Click “Environment Variables…”, the button near the bottom of the popup window
- 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. - 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. - 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.
Tags: contribution, cordova, software developmentCategorised in: Android, Cordova, Javascript, Software Development