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

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:


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 Comment

My first mobile app –built with Cordova | David Sherlock · October 6, 2014 at 4:03 pm

[…] It is not quite as simple as ‘make a website, stick it on your phone’. If like me, you have some web development experience but no mobile development experience then the hardest bit will be working out how to package up your application for the different platforms. I have only used Android which lets you self sign your applications making it not too hard, I suspect that publishing to iPhone will be harder as I think you’ll need to sign with a certificate you get from Apple (I’m guessing that’s what the £100 a year buys you). Adobe runs a service that will do the packaging for you, but it only seems to support certain plugins. I wrote some notes about the bits that tripped me up. […]

Leave a Reply

Avatar placeholder

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