Notes on publishing PhoneGap / Cordova app to Google Play store

I’ve started making apps with Cordova / PhoneGap. My set up is somewhat unconventional as I am just creating the projects at the command line, writing the applications using web technologies and signing them myself. I am not using the PhoneGap build service or any emulators on my machine. I am however using Eclipse because I am just used to it as an IDE, I have also been debugging the apps on a physical Nexus 4 . Since my setup is somewhat different and confusing I ended up getting information from many different places and thought I better write down some of the steps that I kept tripping up on.

I installed Cordova using terminal:

npm install -g cordova

Creating a project

cordova create  <projectname> com.paddytherabbit.projectname

I’m only developing for android but I need to add this as a platform to the project.

Cd <projectname>
cordova platform add android

I wanted to add plugins to the project. The advantage of not using Adobe Build is you can add plugins to your project that aren’t limited to the Adobe approved ones. For example to add the network information plugin for phonegap from it’s Github repository:

cordova plugin add org.apache.cordova.network-information

You can check which plugins are installed with:

cordova plugin ls

to build and run the project:

cordova build && cordova run

To get the project on the play store you need to sign it with a certificate. You can create the certificate yourself. Since I’m using Eclipse with the  I decided to use eclipse to generate the certificate as I already manage and create certificates using the eclipse keytool pluging http://keytool.sourceforge.net/update

Automating the signing process was difficult for somebody not that familiar with ant, there was a lack of clear documentation on how to do this, but I did find this guide by Adam Wade Harris worked perfectly : http://www.adamwadeharris.com/android-automation/ . I’ll duplicate his instructions for the sake of my own notes, but all credit goes to Adam:

Open platforms/android/build.xml and make sure it has/add

<property file="ant.properties" />
<import file="custom_rules.xml" optional="true" />

Open/create platforms/android/ant.properties and add:

key.store /path/to/my-eclipse-created-release-key.keystore
key.alias=app_name

Open platform/android/custom_rules.xml and somewhere in the project tag add:

<property file="../../../secure.properties" />

In this example the secure.properties is outside of the project directory so git /svn misses it. Create the secure.properties file and put:

key.store.password=mypassword
key.alias.password=mypassword

Then you can build the project using:

ant release

You can find apk in platforms/android/bin. As long as you have an updated version number of the application you should now be able to upload it to the play store.

 

Video of the process, not including signing process:

1 Reply to “Notes on publishing PhoneGap / Cordova app to Google Play store”

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.