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.
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.
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
Here 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.
5. Now move to the directory where we have created the application using cd command.
6. Type the following command to create the application for Android.
phonegap run android
phonegap local run android
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.
Summary: So using the following example we can create the Android app using PhoneGap 3.0 and test in the android device or emulator.