Overview

This page will help you if you want to build the JSRs from the source.

Requirements

You must install the Android SDK (at least the version level 8 - Android 2.2). See the Android SDK web site for details.

You must install Maven version 3. You also need the maven-android-plugin.

You must install Mercurial.

If you plan to develop with eclipse, you should install the Maven eclipse plug-in and the Mercurial eclipse plug-in.

Command Line

Check out the sources and build the modules with Maven.

$ hg clone http://jsr4android.hg.sourceforge.net:8000/hgroot/jsr4android/jsr4android
$ cd jsr4android
$ mvn clean install

You should get something ending like:

[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO] 
[INFO] JSRs for Android .................................. SUCCESS [0.206s]
[INFO] JSRs implementations .............................. SUCCESS [0.009s]
[INFO] JSR-226 for Android ............................... SUCCESS [4.563s]
[INFO] Test applications ................................. SUCCESS [0.003s]
[INFO] Test application of JSR-226 ....................... SUCCESS [8.483s]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 14.658s
[INFO] Finished at: Sat Nov 06 14:21:16 CET 2010
[INFO] Final Memory: 35M/618M
[INFO] ------------------------------------------------------------------------

The binaries have been installed in the Maven local repository (~/.m2 on Unix/Linux/Mac OS X ; C:\Documents and Settings\username\.m2 or C:\Users\username\.m2 on Windows), under the .m2/repository/net/sf/jsr4android directory.

Eclipse

Check out the source

Menu File / New / Project...

Select 'Clone Existing Mercurial Repository'

Clone Existing Mercurial Repository

Enter the project Mercurial URL

http://jsr4android.hg.sourceforge.net:8000/hgroot/jsr4android/jsr4android

No need to enter a username or a password. Select the destination directory and click 'Next'.

Clone fill form

Select the last revision (default) and click 'Next'.

Default revision

Click on 'Finish' to create the new project.

Last form

Create the other projects

Menu File / Import...

Select 'Existing Maven Projects'

Select Maven existing projects

Click on 'Browse...' and select the jsr4android directory. Select the projects to create and click on 'Finish'.

Select the projects to create

Eclipse configuration cleaning

Eclipse updates the .classpath files to add a dependency with a JRE. In test applications projects, eclipse also removes the none existing 'gen' directory entry (the directory is created automatically when the Android eclipse plug-in creates the R.java class). You must revert the .classpath.

Go to the 'Team Synchronizing' perspective, synchronize the jsr4android projects. Select the .classpath files and revert the changes.

Revert .classpath files changes

Troubleshouting

Source folder 'gen' missing

If you check-out the sources in a new workspace, make sure that the Android SDK path is set (menu Window / Preferences, panel Android).

If the error persists, create a dummy Android project to complete the eclipse workspace setup. Select the menu File / New / Android Project and create a project. Clean the projects once or twice (Menu Project / Clean...) and the errors should be fixed. You may than delete the dummy project.

File R.java missing

After the check-out of the sources or if you build the project using the 'mvn' command, eclipse may display errors about the class R. Just clean the project once or twice to restore the R.java generated file.