Notes to develop Funambol for Android in Eclipse

I want to share the notes I took when setting up Funambol for Android in Eclipse. I hope somebody can review them and let me know if they work.

Start with installing Sun java SDK and install Android SDK. I followed the instructions on http://developer.android.com/sdk/installing.html

To install Eclipse 3.5 (Galileo) I used the tarball from eclipse.org, didn’t use the .deb provided in Ubuntu because I think it would have installed openjdk which is not compatible with Android SDK.  Install Google API for Android 2.1 using the ADT Plugin for Eclipse (follow instructions on http://developer.android.com/sdk/installing.html). At this point you should be able to build the HelloWorld app for Android.

In order to build Funambol for Android you need to checkout the source

$ svn checkout https://android-client.forge.funambol.org/svn/android-client/trunk android-client –username guest

(or user your own login name). Look at README.txt and make sure to install ant ant-optional javacc (you should already have java sdk, unzip and subversion). Also you need to get ant-contrib v. 0.6 in order to build Funambol. Download it from the old release repository. Unzip it and put the jar file where you prefer. Later you’ll have to tell Eclipse where to find it.

$ sudo cp ~/tmp/ant-contrib-0.6/lib/ant-contrib-0.6.jar /usr/share/ant/lib/

Copy the build.properties file as described in Funambol Android README.txt and configure it.

$ cp build.properties.example build.properties

There is a small issue with the build.xml file so unless you checked out the source code in your home folder under /funambol/build/android/ you’ll have to edit line 10 of build.xml and fix the path in order for build.properties to be read.

Now it’s time to start Eclipse and import the project: start a New Project and pick Android project type, pick Create from existing source and navigate to the directory where you checked out Funambol for Android. Assign a name to the project, set the build target and hit Finish.

Add the ant-contrib 0.6 jar to Eclipse: go to Window -> Preferences. Navigate to Ant -> Global Entries and Add external jar ant-contrib-0.6.jar.

Now open build.xml from Funambol Project in Eclipse and hit ‘run’. This will trigger the Ant build process. Use defaults. Once that’s done you’ll need to configure the project to use the external jars that the build has just created. Go to the project properties and add all jars in external-libs/ to the Java Build Path.  You’ll need to delete R.java that was created by ant build because Eclipse ADT plugin will try to create a new one and the two conflict.

$ rm [your path]src/com/funambol/android/R.java

This was enough for me to get started building Funambol for Android. I’m sure there are more other things to address, for example AndroidManifest.xml shows the following error:

Multiple annotations found at this line:
– error: Error: No resource type specified (at ‘versionCode’ with
value ‘@@@application.version.code@@@’).
– error: Error: No resource type specified (at ‘versionName’ with
value ‘@@@application.version@@@’).

I had to put static values in order to be able to run the Funambol app in the emulator using Eclipse. For the long term it may be a good idea to add an eclipse target in build.xml that doesn’t generate R.java.