Customize Your Build

As mentioned above, you need to create a custom build. To begin, use something like the following command to create an Android project (refer to the Android developer guide):

android create project –target android-2 –name XBinderRSS –path . –activity RSSReader –package com.objsys.xbinder.sample.rss

This will create directories and generate several files, including AndroidManifest.xml, and build.xml

Next, customize build.xml. The build.xml for the AndroidRSS sample illustrates these customizations. In summary they are:

  1. Disable import in the "setup" task. Copy the contents of the android_rules.xml file into build.xml. Instructions for this are contained in the build.xml file itself.

  2. Add XBINDER_HOME property

  3. Add copyJars task to copy JAR files into the libs folder (you could manually copy the files one time)

  4. Add XBinder task to run XBinder to compile your XSD

  5. Modify the compile task to depend on the XBinder and copyJars tasks

  6. Modify the dex task to operate on the repackaged jar

  7. Add repackageJars task to repackage your code and the Android support JARs into a single JAR.

Task 'repackageJars' uses a tool called Jar Jar Links. It should be located at XBinder/java/android/buildtools/jarjar-1.0.jar. It can also be downloaded from the project site This tool merges the contents of multiple JARs into a single JAR. More importantly, for our purposes, it can also modify class names. We supply the rule:

<rule pattern="javax.xml.**" result="com.objsys.javax.xml.@1"/>

in order to rename javax.xml.* classes to com.objsys.javax.xml.* This converts "core" classes into non-core classes, so that the DEX conversion can succeed.


If you are using any classes in a javax.xml.* package that should NOT be renamed (ie, those not contained in the Android support JARs), the rule given above will be too broad; you will need to use more selective rules. For example, if you have references to class javax.xml.parsers.DocumentBuilderFactory, they should not be changed into references to com.objsys.javax.xml.parsers.DocumentBuilderFactory; the former class is part of Android; the latter class will not be present.


For the AndroidRSS sample, we used the android_rules.xml file from the Android 1.1 platform to customize our build.xml file. The customizations may vary somewhat if you use an android_rules.xml file from a later version of the Android platform.