Building Phonegap on Ubuntu

Phonegap is a cool set of tools (which I am about to try out for the first time) which lets you build applications in HTML / Javascript for Android and iPhones. I had some trouble installing out of the box on Ubuntu 9.10 (Karmic), so I thought I’d document my fix.

So first we configure:


You’ll first get an error like this:

Building PhoneGap Makefile
No Doxygen found; fetch it from and install it in /Applications
Run "make" to build

To fix this you first need to install doxygen:

sudo apt-get install doxygen

..then modify the Makefile to point at doxygen. On line ~19 you’ll fine DOXYGEN= pointing to nothing. Modify it to read:

DOXYGEN = /usr/bin/doxygen

Then run:

./configure && make

You’ll end up hitting errors such as:

java -jar util/yuicompressor-2.4.2.jar --charset UTF-8 -o lib/iphone/phonegap-min.js lib/iphone/phonegap.js

[ERROR] 1072:9:missing ; before statement
[ERROR] 1073:14:syntax error
[ERROR] 1074:1:syntax error
[ERROR] 1183:14:missing ; before statement
[ERROR] 1184:11:syntax error
[ERROR] 1185:1:syntax error
[ERROR] 1:0:Compilation produced 6 syntax errors.
org.mozilla.javascript.EvaluatorException: Compilation produced 6 syntax errors.
	at org.mozilla.javascript.Parser.parse(
	at org.mozilla.javascript.Parser.parse(
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(
	at java.lang.reflect.Method.invoke(
make: *** [lib/iphone/phonegap-min.js] Error 2

Head to line 1072 of lib/iphone/phonegap.js and add a new line and semi-colon between }Compass, then head to line 1184 and add another new line and semi-colon between }Notification.

You can then go ahead and run the Makefile again.