December 12, 2013

PhoneGap Installation and running Sample Application on Windows



1.       Node.js
2.       Ant (Zip)
3.       Java SDK 1.7
4.       Android SDK
5.       Eclipse (Zip)
6.       Cordova (Zip)

Setup Environment Variables

1.       NODEJS_HOME
2.       ANT_HOME
3.       JAVA_HOME
4.       ANDROID_SDK

PATH Environment Variable Update

Add NODEJS\bin;ANT_HOME\bin;JAVA_HOME\bin;ANDROID_SDK\tools;ANDROID_SDK\platform-tools

Install phonegap

If you are behind a proxy please set the proxy to npm (Node.js) command
(HTTP) C:\> npm config set proxy
(HTTPS) C:\> npm config set https-proxy

Run the install command

C:\> npm install –g phonegap
C:\> npm install –g cordova
Note: If you get any ”shasum (Checksum)” error, then please
i)                    clear the npm and npm-cache directories from %User%/AppData/Roaming folder
ii)                  Install the latest npm version
Currently it is 1.3.21
npm install
npm install -g phonegap

Create Project

Syntax: phonegap create
Ex: phonegap create FirstPhnGpPrj PhoneGapPrj1

·         Now it will create some folders and corresponding files (HTML, CSS, JS)
·         Change the directory to your project directory
o   Ex:- C:\> cd FirstPhnGpPrj

Add Platform

Syntax: cordova platform add
Ex:- C:\FirstPhnGpPrj> cordova platform add android

If it’s not working then you need to install the cordova (npm install –g cordova)
Copy the cordova-android\bin from your downloaded&extracted zip file to %User%\.cordova\bin

Run Phonegap for Individual Platform

Syntax: phonegap run
Ex:- C:\FirstPhnGpPrj> phonegap run android

1.       By now, you will be getting your Android project hierarchy in your project_folder\platforms\android\
2.       Import the existing android code from your Eclipse
3.       Create\manage AVD
4.       Run the project

Adding Plugins to your project


·         Install Git
Tip: If you are behind a proxy then please add it your configuration
Syntax: git config –global http.proxy
Ex: git config –global http.proxy

·         Add git\bin to your PATH environment variable
·         You need to download the git files from So make sure that the above specified URL is not blocked by your firewall
·         Navigate to your project directory in command prompt by changing the directory

Install Plugin

Syntax: phonegap local plugin add
Ex:- phonegap local plugin add
Tip: If this doesn’t run then try with cordova
Syntax: cordova plugin add

Remove Plugin

Syntax: phonegap local plugin remove
Ex:- phonegap local plugin remove
Tip: If this doesn’t run then try with cordova
Syntax: cordova plugin remove


You can install “plugman” to plug and play with plugins by following this link


Post a Comment

Featured Post

Java Introdcution

Please send your review and feedback to