-
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.
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 faulty dependencies, which end in SNAPSHOT like the one below, where this is probably the best option.
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 an API that you haven't installed. Make sure you've installed all the APIs from Getting Started with Tango and ROS. If the error persists, it's probably best to download the required API using the 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.
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.
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 with gradle, 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 gradle commands available. 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 ../gradlew tasks
is failing at that point, 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'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.