phonegap

Hey, friends, for those who don’t know me I am a Mobile App developer and this post deals with building an ‘apk’ file in Ionic 2 using PhoneGap Build. If you are looking into this article i am sure you might be knowing how to create a simple ionic 2 application. Anyways, no worries for those who don’t know because we are here with every problem’s solution(I meant regarding coding). You can find links below that will help you with creating Ionic 2 projects: here
Guys, just note that if you want to know how to create an Ionic 2 app and generate its apk file through ‘command prompt’, you can follow here.
Now let me brief you with the steps that we will be seeing in detail:

  • Creating Adobe id,
  • Working on Config.xml file,
  • Creating a zip folder of your project,
  • Log in using the same id,
  • Generating the key,
  • Upload the zip folder with the key generated,
  • And the last, your apk will be generated.

Whoooo…. That’s one big process. No, don’t think of backing out after coming this far. After these steps you would be amazed to see your application running on your own phone. So buckle up and let’s do this.(I hope i encouraged you.)

Just a small notice: First create Adobe Id and use the same in phoneGap.

1)Create Adobe ID:

signup

Fill in the fields and click on sign up.
2) Working on Config.xml file:
This is the file which contains all the stuffs we need in our application(or can say the main boss of the whole process). So carefully handle it.
Firstly, copy the ‘config.xml’ file into the ‘www’ folder(you will find this boss outside the ‘www’ folder) as PhoneGap requires this file(make it sure that you copy it and not cut it). The CLI will need the ‘config.xml’ file from outside the ‘www’ folder.

Example:-

mahesh

3)Creating a zip folder:

  • First, we will build the app through command prompt,
     ionic build android
  • Then go inside the project folder
     demo1\www
  • Create the zip file of your www folder by right clicking on it and selecting ‘Send to’ and then ‘Compressed (zipped)’ folder option.This will create a ‘.zip’ file of your project.

Now here comes an easy step. Whooo……
4) Login into Phonegap with same Adobe id:
On logging-in, first window will be as same as below.Click on private tab as shown:

upload

Then follow the next step,
5)Uploading our Project’s Zip file:

  • Click on Upload a .zip file button and upload your .zip file here.
  • After Uploading, Your screen will display the page as below:

zip1

  • Click on Ready to build button which will display the following screen:

zip2

  • Click on android icon. Now your screen will look like:

zip3

6) Generating the Key:
a) Download and install java.
b) Set Java path (c:\program files\java\jdk 1.8.0_112\bin).
c) Open command prompt and type this syntax-

C:\users\gtr>keytool -genkey -v -keystore [keystore_name].keystore -alias [alias_name] -keyalg RSA -keysize 2048 -validity 10000

d) Create Keystore password
Create password and give answer of questions

Enter keystore password:
Re-enter new password:
What is your first and last name?
[Unknown]: mahesh What is the name of your organizational unit?
[Unknown]: test
What is the name of your organization?
[Unknown]: Test
What is the name of your City or Locality?
[Unknown]: test_place
What is the name of your State or Province?
[Unknown]: test_state
What is the two-letter country code for this unit?
[Unknown]: test_country
Is CN=mahesh, OU=test, O=Test , L=test_place , ST=test_state , C=test_country correct? [no]:

“Type yes and then click enter”

Enter key password for (RETURN if same as keystore password):
Re-enter new password:

f) Your signing key is ready to submit:

[Storing test.keystore]

g) File:
You can find above generated keystore file at the location where you have done above code. In our case, it’s C:\users\gtr.(see location in image on step 3 above).
h) Submit your key to build, follow the steps:-

  •  Go to your account of Phonegap.
  • Then click Edit account.
  • Click on Signing keys tab.
  • Click Add key under android section:

edit_account_settings

On clicking, a drop down occur:
You must use same title and alias which you used while generating key.

add_key

i) Unlocking Your Key:

  • Go to your account of Phonegap.
  • Then click Edit account.
  • Click on Signing keys tab.
  • Click unlock button and supply the certificate password and keystore password.

unlock_key

Then click submit key.

Note(for those who are planning to upload their application into google play store): If you have not downloaded the key, you can skip this option as it will not affect your apk generation, but if you do so, you will not be able to upload your apk on Google play store.
Finally, we have reached our last step. Go on, create your apk and try running it on your phone.
7) Generating apk file:
For this step, click on the apk button to generate your apk file. Once downloaded, install it and run it on your particular device.
Is it running fine?
I hope it does. If not please follow the steps again(carefully this time).
If yes, Hurray…. Pat your back, as you have just developed a mobile application. Go on and share with your friends and do share this article too, so that they too can develop mobile application. And any queries regarding the above steps are most welcome. Good Luck with your application. See you soon with much more needed articles on Ionic 2 applications. So stay tuned with our updates.

Build an apk file in Ionic 2 using ‘PhoneGap Build’ in Windows

Most Popular

Have a Great startup Idea and want to make it possible? Looking for an extraordinary team to build a mobile or Web app for your idea to come into reality? Then you are at right place. I provide my services for mobile and web app development.

Copyright © 2019 CrocoCode. All rights reserved.

To Top