-
Notifications
You must be signed in to change notification settings - Fork 41
Troubleshooting ROSTango Build Failures
This page describes some common causes of failure when building the ROSTango apps and suggests possible solutions. However, this is by no means an exhaustive list.
Common errors:
- Missing SDK/SDK location not found
- Failed to parse SDK
- Could not resolve all dependencies
- Failed to find target android-19 (or any other version)
- Lint found errors in the project
First, make sure you installed all SDK pieces described in Getting Started with Tango and ROS. If you think you may have forgotten anything, open the Android SDK Manager and check.
> android
If that seems correct, check that $ANDROID_HOME
points to your SDK location.
> echo $ANDROID_HOME
/opt/android-studio/sdk
Make sure to start a new terminal session after changing environment variables like $ANDROID_HOME
.
This error can generally be solved quite simply by creating a file in ~/rjandroid/src/ROSTango/ROSTango/src/rostango
called local.properties
containing the following:
sdk.dir=/opt/android-studio/sdk
(If your SDK is located elsewhere, modify as needed.)
First, open up ~/rjandroid/src/ROSTango/ROSTango/src/rostango/build.gradle
. There should be a call to at least one of mavenCentral()
and mavenLocal()
in the repositories section (under buildscript). If only mavenLocal()
is present, add mavenCentral()
directly above it. If that doesn't work, try commenting out mavenLocal()
.
If the error persists, you may want to try to locate the dependency yourself (and then persuade gradle that it is in fact present), or download it if it really doesn't seem to exist.
Alternatively, you may want to simply remove the dependency in some situations (such as if the dependency's only purpose seems to be debugging software that works well). There are a few dependencies, which end in SNAPSHOT like the one below, where this option seems best.
A problem occurred configuring project ':tango_serial'.
> Could not resolve all dependencies for configuration ':tango_serial:_debugCompile'.
> Could not resolve org.ros.tf2:tf2_ros:0.0.0-SNAPSHOT.
Required by:
com.github.rosjava.rostango:tango_serial:0.1.0
> java.lang.NullPointerException (no error message)
If you want to remove a dependency altogether, find the build.gradle file for the correct project (in this case, tango_serial
), locate the dependencies section, and comment out the dependency you wish to remove.
Here, something is most likely trying to use a version of the API that you haven't installed. Make sure you've installed all the APIs from Getting Started with Tango and ROS. If you have all these APIs and the error persists, it's probably best to download the required API using Android SDK Manager.
> android
By default, the build will abort if lint finds any issues in a project. It's probably a good idea to check the lint report for anything particularly serious. However, if all the issues seem minor, you may want to modify the project's build.gradle
file so that the build will proceed despite errors. Alternatively, if you're building with gradle, you could use ../gradlew assemble
instead of ../gradlew build
to skip the lint check. (See the Troubleshooting Tips section below for more on building with gradle.)
First, determine which project is failing lint. There should be a line in the error message resembling the following:
Execution failed for task ':tango_serial:lint'.
In this case, the failing project is tango_serial
.
Next, locate the project's build.gradle
file. In the case of tango_serial
, this file is located at ~/rjandroid/src/ROSTango/ROSTango/src/rostango/tango_serial/build.gradle
. Do not use the build.gradle
located in rostango
. (If you want to build the entire package using gradle, either use ./gradlew assemble
to skip the lint check or modify each project's build.gradle
.)
Add the following to the android section:
lintOptions {
abortOnError false
}
The project should now build despite lint errors. You may have to repeat this process for multiple projects. In the future, it's probably a good idea to check the lint output for any serious problems, even if lint errors don't automatically abort the build.
If catkin_make
isn't working, try building individual projects using the gradle wrapper, seeing which fail and which don't. To build a project (for example, tango_serial
) with gradle, first cd
to the project directory:
> cd ~/rjandroid/src/ROSTango/ROSTango/src/rostango/tango_serial/
The project directory should be inside a directory containing a gradlew
executable. For example, tango_serial
is under rostango
, which contains a gradlew
. Try to build the project:
> ../gradlew build
If that fails, run the following:
> ../gradlew tasks
This will attempt to list the available gradle wrapper commands. If ../gradlew tasks
fails, gradle is probably failing to find a dependency. If ../gradlew tasks
succeeds but ../gradlew build
fails, dependencies are not an issue for that project. This is because the first thing every gradle command tries to do is resolve dependencies. If commands are failing when they attempt to resolve dependencies, try to figure out what dependency is causing trouble.
If you're at a loss as to why ../gradlew build
is failing, run
> ../gradlew clean
and try the build again.
If you'd like to use gradle to build an entire package containing multiple gradle projects (e.g. rostango
), you'll need to use ./gradlew assemble
instead of ./gradlew build
(from the package directory) to skip the lint check, as the build.gradle
modification described above won't work at the package level.
If you're experiencing another type of build issue, or these solutions don't seem to be working, the following links might be able to help you.
- ROSJava documentation on the ROS Wiki: http://wiki.ros.org/rosjava
- Whether to use catkin or gradle: http://wiki.ros.org/rosjava/Tutorials/hydro/To%20Build%20with%20Catkin%20or%20Gradle
- More ROSJava documentation: http://rosjava.github.io/rosjava_core/hydro/index.html