ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

Error building rosjava.jar

asked 2011-05-31 20:23:57 -0600

Benoit Larochelle gravatar image

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:
/opt/ros/javagooglecode/rosjava/android/library/build.xml:37: Cannot find ${sdk.dir}/tools/ant/pre_setup.xml imported from /opt/ros/javagooglecode/rosjava/android/library/build.xml

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 flag offensive close merge delete

4 Answers

Sort by ยป oldest newest most voted
2

answered 2011-06-03 02:43:14 -0600

hawesie gravatar image

updated 2011-06-05 13:48:34 -0600

tfoote gravatar image

You need to download and configure your Android ADK first.

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
edit flag offensive delete link more

Comments

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.
kwc gravatar image kwc  ( 2011-06-05 13:54:26 -0600 )edit
1

answered 2011-06-05 07:36:00 -0600

kwc gravatar image

updated 2011-06-05 13:54:39 -0600

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.

edit flag offensive delete link more
0

answered 2011-06-05 16:03:12 -0600

Hordur gravatar image

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.

For more details see http://code.google.com/p/android/issues/detail?id=13024

edit flag offensive delete link more
0

answered 2011-06-06 00:47:48 -0600

Oryonym gravatar image

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:
/myfolder/android-sdk-linux_x86/tools/ant/pre_setup.xml:13: taskdef class com.android.ant.SetupTask cannot be found
 using the classloader AntClassLoader[]

What could be the problem?

Thanks!

edit flag offensive delete link more

Comments

Does /myfolder/android-sdk-linux_x86/tools/lib contain anttasks.jar?
Hordur gravatar image Hordur  ( 2011-06-06 01:31:29 -0600 )edit
Yes, I have it...
Oryonym gravatar image Oryonym  ( 2011-06-06 03:55:17 -0600 )edit
please ask this as a separate question/post
kwc gravatar image kwc  ( 2011-06-06 05:47:13 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2011-05-31 20:23:57 -0600

Seen: 1,604 times

Last updated: Jun 06 '11