Sunday, April 3, 2016

How to build/compile from phonegap app to android app by using android sdk and phonegap cli?

This article lights the information about build Phonegap app to android App (someApp.apk).

Tools Required

You need to install the below tools, this article is not about how to install these tools. You will get
various information on the internet about installing process.

1) nodejs
2) Git

After installing this, run below command for installing latest phonegap cli

npm install -g phonegap@latest

Now install the Android SDK ide from Here.

Add environment variable

Create new environment path variable ANDROID_HOME and add your Android sdk path as shown in below image. My android sdk location is as mentioned below, it might differ in your case.

C:\Users\suman\AppData\Local\Android\sdk


Add the below line in PATH variable, follow the instruction as shown in below image

;%ANDROID_HOME%\platform-tools;%ANDROID_HOME%\tools;


Be careful, do not remove any other path when you would add ANDROID_HOME path variable.

Chek Android Sdk is installed

Now run the command android from your “command prompt”, below screen ensures that the android sdk is installed.


Now you have installed all required tools nodejs, git, phonegap cli, and android sdk. Now it's time to create and build a phonegap project.

Create phonegap Project

Make a phonegap project by running

phonegap create hello com.myapp.hello HelloWorld

Customize the app

Now, do customize your app as your requirement. After done this go to project directory by

cd hello

From your project folder, Add the platform for your app according to your requirement, it's Android in my case, so I initiate the command

phonegap platform add android

Now, import that created project hello in your Android Sdk IDE, for doing this open the android sdk and do click on link Import project (Eclipse ADT, Gradle etc) as in



After importing the project, select "Project Files" like


From here also you may able to customize the app as shown in below image



Build/Compile phonegap app to Android app

For compiling the app with your Android Sdk IDE, go to "Build -> Generate Signed APK",  and create the key for your app by providing required information as indicated by below image.


During the build process you can change the app file name as in my case it's myappname.apk,


Move on as suggested by and Android Sdk IDE, After a while, the build process will be completed and the window is opened as below



Now the app mappname.apk is ready to install in your android phone.