Creating PhoneGap Android application using version 3.0.

Introduction: Previously PhoneGap was providing total package as a single version which contains all the necessary files for each platform. We are downloading the zip as a version and integrating the required files inside our Android application. It was working same till version 2.9 but from version 3.0 onwards the scenario is little different.

Description: From 3.0 onwards PhoneGap is not providing the zip file to download and integrate the same with our application. Now it is giving the install option, so we can directly install the PhoneGap into our system and use the same to create the application. Here we will focus on creating the Android application using version 3.0.

To install the PhoneGap we need some dependencies which will help PhoneGap to work properly.

1. In this step we need to ensure that we have already installed the JDK and Android SDK. If not we can download the JDK and android sdk from following links.

https://jdk8.java.net/download.html

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

We need to make sure that we have installed the latest sdk tools and sdk platform tools. Also we need the Android 4.3(API 17) which is necessary for making android app using PhoneGap 3.0.

2. In this step we need to install Node.js which can be downloaded from following link.

http://nodejs.org/

Node.js is the JavaScript run time platform which will help us to invoke npm or node in the command prompt.

3. So after installing the node.js, open the command prompt and type the following command to install PhoneGap in your local system.

npm install -g phonegap

4. Then we need to create the application using following command

phonegap create Dummy com.mindfire.dummy DummyApp

ImageHere create command needs 3 parameter after it, Dummy is the directory name that will be created for the project. And the next 2 parameter are optional, com.mindfire.dummy is the package name for the application and DummyApp is the application name that will be displayed to user.

ImageHere we can see the folder structure that will be created after executing the above command.

5. Now move to the directory where we have created the application using cd command.

cd Dummy

6. Type the following command to create the application for Android.

phonegap run android

or

phonegap local run android

ImageIt will create the android app inside platform folder. And it will install the application into the emulator or device attached to the system.

Note : While using the run command, we may face some error. In that case, we can go for local run which will explicitly create the app in our local system.

ImageHere is the folder structure that will be created after executing the run command. So now we are ready with our new Android application and we can modify the code as per our requirement.

Summary: So using the following example we can create the Android app using PhoneGap 3.0 and test in the android device or emulator.

Written By: Sourabha Kumar Sahoo, Software Developer, Mindfire Solutions

Advertisements

One thought on “Creating PhoneGap Android application using version 3.0.

  1. Pingback: Creating PhoneGap Android application using version 3.0. | souravsahoo

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s