Sunday 8 June 2014

Installing Apache Cordova using CLI (Command Line Interface)


Pre-requisites:
JDK 1.7.0
ADT Bundle
Apache Ant
NodeJS

Install JAVA:
http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html

Install ADT:
http://developer.android.com/sdk/index.html

Install APACHE ANT:
http://ant.apache.org/bindownload.cgi

Install NodeJS:
http://nodejs.org/

Environment Variables:

On windows, right click on My Computer -> Properties -> Advanced System Settings -> Under the Advanced Tab -> Environment Variables.

Set Environment Variables for Java, Ant,Android and NPM.

User Variables:

JAVA_HOME: C:\Program Files\Java\jdk1.7.0_60

PATH: C:\Users\HP\AppData\Roaming\npm;F:\Pushpender\adt-bundle-windows-x86_64-20140321\adt-bundle-windows-x86_64-20140321\sdk\tools;F:\Pushpender\adt-bundle-windows-x86_64-20140321\adt-bundle-windows-x86_64-20140321\sdk\platform-tools;C:\Program Files\nodejs\;

System Variables:
PATH:F:\Pushpender\apache-ant-1.9.4\bin\;

A restart might be required for the changes.

Open Command Prompt and follow the below instructions:

Cordova CLI Instruction:
npm install -g cordova
cordova create my-app
cd my-app
cordova platform add android
cordova build android

References:
http://phonegap.com/install/
http://docs.phonegap.com