# Error building rosjava.jar

I'm trying to install rosjava from the official instructions: http://code.google.com/p/rosjava/wiki/Welcome

but I'm stuck at the step where I have to build rosjava.jar. When I type ant dist, I get this:

BUILD FAILED
/opt/ros/javagooglecode/rosjava/build.xml:5: The following error occurred while executing this line:
/opt/ros/javagooglecode/rosjava/build-common.xml:16: The following error occurred while executing this line:
/opt/ros/javagooglecode/rosjava/dependencies.xml:20: The following error occurred while executing this line:
/opt/ros/javagooglecode/rosjava/android/build.xml:6: The following error occurred while executing this line:


I followed the solution presented here: http://stackoverflow.com/questions/6159909/ant-cannot-firn-pre-setup-xml-for-an-android-project, but it did not change anything.

Note than when I type android, it is not a recognized command, so I have to type the full path the to Android installation folder on my desktop. I don't know if this could be a problem.

edit retag close merge delete

Sort by » oldest newest most voted

You need to specify the value of the sdk.dir property for the Java build. One way of doing it is via a -D flag for ant:

ant -Dsdk.dir=<path to sdk> dist


e.g.

ant -Dsdk.dir=/opt/android-sdk-mac_x86 dist


Also if you see an error like this:

/Users/nah/ros-diamondback/rosjava/android/library/build.xml:77: Unable to resolve target 'android-9'


You'll need to set the target property as appropriate. E.g. I had the 2.3.3 SDK installed, so I needed to compile with:

ant -Dsdk.dir=/opt/android-sdk-mac_x86 -Dtarget=android-10 dist

more

you don't need to manually pass in these properties if you use the 'android' command to create the local properties file. Please see the 'android update' command.
( 2011-06-05 13:54:26 -0500 )edit

You need to download and configure your Android ADK first, then follow the solution in the stack overflow answer. The android command needs to be setup on your PATH (point to the tools directory of your android ADK). When you are setup correctly, you should be able to type the android command.

more

If you run 'android update' in the library you will have to remember to add

<path id="android.libraries.src"><path refid="project.libraries.src" /></path>
<path id="android.libraries.jars"><path refid="project.libraries.jars" /></path>


after <setup /> in build.xml because it is replaced by tools/lib/build.template from the Android SDK. An alternative would be to add it to the template.

more

Hello all,

I'm stuck in the same step, with the difference that the "android" command is working for me, meaning that I have it well configured.

At first, when I typed "ant dist" I obtained an error saying that it was unable to find the correct sdk.dir variable path. Then I decided to hard-code the path
of my sdk android installation. Now, when type the "ant dist" command what I get is:

BUILD FAILED
/myfolder/rosjava/rosjava/build.xml:5: The following error occurred while executing this line:
/myfolder/rosjava/rosjava/build-common.xml:16: The following error occurred while executing this line:
/myfolder/rosjava/rosjava/dependencies.xml:20: The following error occurred while executing this line:
/myfolder/rosjava/rosjava/android/build.xml:6: The following error occurred while executing this line:
/myfolder/rosjava/rosjava/android/library/build.xml:38: The following error occurred while executing this line:


What could be the problem?

Thanks!

more

( 2011-06-06 01:31:29 -0500 )edit
Yes, I have it...
( 2011-06-06 03:55:17 -0500 )edit
( 2011-06-06 05:47:13 -0500 )edit
( 2011-06-07 00:54:08 -0500 )edit