Build Android Apps with Phonegap

1

Stats

11,460 visits, 17,034 views

Tools

License

This tutorial is licensed under CC BY 4.0. Please refer to the license text if you wish to reuse, share or remix the content contained within this tutorial.

Published on 23 May, 2017. Last updated 19 Feb, 2019

Hello Everyone,

This is a simple tutorial in how to Build your C2 Games, and make them ready for Publish for Android using Phonegap. Hopefully you will find this tutorial useful. Anyhow, let’s start.

Before you go any further, and don’t want to read the whole tutorial. Here check out the video which covers' the whole tutorial

Subscribe to Construct videos now

$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$

# Ok, for all who want to read here we go :).

1- When you’re ready to Export your project. Chose Cordova -> Next -> Uncheck "Use new Intel XDK project format" -> Export

2- Go to where saved your project and open Config.xml File -> Use Notepad, But I highly recommend to open it with Notepad++ to read the code better. You can download Notepad++ from here:

https://notepad-plus-plus.org/

# Add these to your Config.xml File:

1-

    <plugin name="cordova-build-architecture" spec="https://github.com/MBuchalik/cordova-build-architecture.git#v1.0.1" source="git" />

2-

    <gap:config-file platform="android" parent="/manifest" mode="delete"> <uses-permission android:name="android.permission.READ_PHONE_STATE"/> </gap:config-file>

3- Change your “android-targetSdkVersion” to 24 -> Optional

4- For code Number 3 to work you need to add this code before your project id:

    xmlns:android = "http://schemas.android.com/apk/res/android" 

- For example, see down picture:

5 - Change your version from “1.0.0.0” to “1.0” -> Optional

$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$

# Explanation why do you need to do these changes to your Config.xml File

1- As you know there is ARM and x86 APK, but most phones use ARM APK, so by adding this code Phonegap will be able to generate ARM APK, and if you don’t add it Phonegap automatically by Default will generate x86 APK.

2- If you are adding AdMob to your game. You need this code to delete “android.permission.READ_PHONE_STATE” since AdMob will add it your code automatically, and you won’t be all to publish your app at Google Play because you will get an error about this permission that need to write a “Privacy Policy” for your app.

3- To get more downloads :), see the chart down:

4- As I said before you need this code, so code number 3 can take actions.

5- If your building for both IOS & Android, you will need to change to two digits because IOS won’t take four digits, and if you don’t change it. You will get an error for IOS. Since, Google Play takes two digits then do it with two and forget about it :).

$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$

# Save the changes, and close the file.

**# Select all everything inside you project file -> Right Click -> Send to

-> Compressed (zipped) folder

**

**# Open now Phonegap Build:

https://build.phonegap.com/**

1- Sign in Or Sign Up if you don’t have an account.

2- Click on “ Upload a .zip file “

3- Now, wait until everything is ready, and you can see your project is uploaded.

4- Click on “ Ready to Build “, wait for a few seconds, then click on the name of the project to enter it.

5- Ok, you may see the Phonegap already build APK. However, this APK is only for Debugging not Publishing, So don’t download it.

6-1 - To get the Publishing APK you need to add your Google Key. You can see to the right, a box saying “ No Key Selected “ click on it -> add a Key -> Fill out the in info needed on the box showing -> choose your Google Key store -> Click Submit Key.

6-2 - Be sure what entered on “Alias “ box is the same name as the Google Key name.

6-3 - Most IMPORTANTLY be sure your Google Key is on this Format .Keystore not .Jks format.

Check out this video tutorial on how to convert your from JKS to Keystore format:

https://www.youtube.com/watch?v=g88QueOPG-I&t=243s

7- Click Rebuild if all number 6 steps are good to go.

8- Download your APK, and you are good to go.

$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$

With this I can concluded the tutorial is over. I hope you found it helpful. Thank you for keeping up either reading or watching the tutorial.

- One last thing, here is a Config.xml File example:

https://drive.google.com/open?id=0B7FBA_KN-1bXWklycTI4T2h4NFE

Good Luck…………….. :) :) :)

  • 2 Comments

  • Order by
Want to leave a comment? Login or Register an account!
  • excuse me, in this tutorial are we done abaut our xml? or we must add again code admob plugin?

    Thank you in advance

  • Hello, Alajajm. Thanks for this tutorial.

    I created an apk, but I need to config it in a way that the screen never turns black to save battery. It´s i kind of chess clock, so I need it to stand running and been showed in the display all the time. Do you know how to configure that?