Pre-requisites
Softwares
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
5.
CORDOVA_ANDROID
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
Syntax:-
(HTTP) C:\> npm config set proxy http://proxy.company.com:port
(HTTPS) C:\> npm config set https-proxy http://proxy.company.com:port
Run the install command
C:\> npm install –g phonegap
C:\> npm install –g cordova
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
Create Project
Syntax:
phonegap create
Ex:
phonegap create FirstPhnGpPrj com.pg.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
Tip:
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
Pre-requisites
·
Install Git
Tip: If you are behind a proxy then please add it your
configuration
Syntax: git config –global http.proxy http://proxyusername:proxypassword@server.company:port
Ex: git config –global http.proxy http://abc:123@xyz.com:8081
·
Add git\bin to your PATH environment variable
·
You need to download the git files from https://git-wip-us.apache.org. 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
cd
Install Plugin
Syntax:
phonegap local plugin add
Ex:-
phonegap local plugin add https://git-wip-us.apache.org/repos/asf/cordova-plugin-device.git
Tip: If this doesn’t run then try with cordova
Syntax: cordova plugin add
Ex:- cordova plugin add https://git-wip-us.apache.org/repos/asf/cordova-plugin-device.git
Remove Plugin
Syntax:
phonegap local plugin remove
Ex:-
phonegap local plugin remove
https://git-wip-us.apache.org/repos/asf/cordova-plugin-device.git
Tip: If this doesn’t run then try with cordova
Syntax: cordova plugin remove
Ex:- cordova plugin remove https://git-wip-us.apache.org/repos/asf/cordova-plugin-device.git
Alternative
You can install “plugman” to plug and play with plugins by
following this link
References
http://docs.phonegap.com/en/3.2.0/plugin_ref_plugman.md.html#Using%20Plugman%20to%20Manage%20Plugins
No comments:
Post a Comment