Manual upgrade of Apache Cordova for Android (2.9.0 to 3.7.0)

I hadn't upgraded Cordova for ages and was still on version 2.4.0 (now at 3.7.0 at the time of writing). so I was surprised, but mostly dismayed, that I now had to use the Cordova tools to create apps.  Maybe it is just me but I liked being able to copy the jar, javascript file and config into an Android app myself.  I did have a go at using the tool, but the npm still didn't create the jar I wanted and I'd be forever tied into using the tool.  So I spent some time working out how to upgrade manually, and this is how to do it.  

This obviously relies on you having java and android installed, which I'd guess you have if you're upgrading an Android app

Step 1

Download the latest zip file from http://cordova.apache.org/ and unzip it.

Step 2 

Install android if necessary and add it to the OS path.  You need ANDROID_HOME set or the android executable on the path.  I added both.

Make sure you have Android version 19 installed from Android's SDK manager

Step 3

Install ant and add it to the OS path so that ant can be executed from the command line

Step 4

Using a command line tool (cmd or bash, or whatever) change directory (cd) to the where you unzipped the cordova zip and cd into the package/framework directory

Run the following command

ant jar

If you get the error message that you need to create 'local.properties' run the following command first (then run ant jar)

android update project -p .

This will create the jar file called cordova-<version>.jar

Step 5

Copy these files from the unzipped cordova directory into your Android app directory structure:
  • the created .jar file to your /libs directory (will be in the framework directory where you created it)
  • cordova.js from the assets directory in the zip file to your app assets directory
That's all I needed to do.  The settings all worked as before and now I've upgraded.  I hope this helps someone and it isn't just me that doesn't want to have to use the Cordova tools :)




Comments

Popular posts from this blog

Launch a website as a mobile app using PhoneGap/Apache Cordova

Installing and using mobilize.js to transform a desktop site to a mobile site

How to manually add Cordova plugins to your app