In this tutorial, we'll go through setting up your build environment and compiling and running your first "Hello Tango" project using the Java API, which will run sample code and display the pose data from your device.
Prerequisites
To successfully follow this guide, you will need:
-
Experience developing Android apps. If you have never created an Android app before, you can get started with our Building Your First App tutorial.
-
The sample project. This includes the Tango Java API files, which you can find in the subfolder named TangoReleaseLibs after you download the project. For download instructions, see the next section.
-
A Tango Tablet Development Kit. You can build the code without one, but you won't be able to run it.
Download the sample project
The sample project is hosted on GitHub. You can download it as a zip file or use git to clone the repository:
git clone https://github.com/googlesamples/tango-examples-java.git
You should now have a directory called tango-examples-java on your
machine. Within this directory you should see a subdirectory called
java_basic_examples, which contains the code for this guide.
Import the project into Android Studio
-
Do one of the following:
- Open Android Studio.
- If you are already in Android Studio with a project loaded, close the project.
Either action takes you to the Welcome to Android Studio screen.
-
Select Import Project (Eclipse ADT, Gradle, etc.). In older versions of Android Studio, this may be Import Non-Android Studio project or simply Import Project.
-
In the Select Eclipse or Gradle Project to Import dialog, navigate to the repository you just cloned. Choose the
java_basic_examplesdirectory and then click OK.
Connect your device
If you haven't already connected your Tango device to your computer, you should do so now.
Build and run an application
Within the basic examples project you loaded, you have a choice of several different "hello"-style apps to build and run. For this tutorial, we'll choose "Hello Motion Tracking."
-
On the toolbar, view the Run/Debug Configuration field and make sure hello_motion_tracking is the active configuration. If it is not, click the field and select it.

-
Do one of the following:
- On the Run menu, click Run.
- On the toolbar, click the Run button (the green arrow).
-
In the Device Chooser dialog, select Choose a running device, then select your Tango tablet, and then click OK.
See logcat for the raw pose data
You can see logcat output automatically in the bottom part of Android Studio.
If you want to see it in your terminal, type
adt_path/sdk/platform-tools/adb logcat
You will see the pose data being printed in your terminal:
I/MainActivity( 6010): Translation: 0.020329, 0.013915, -0.008571 | Rotation: 0.581630, 0.014597, -0.021857, 0.813029
Next steps
Now that you have learned how to set up your environment for development with the Tango Java API, proceed to the following links to learn how to use specific features of Tango in your app:
Also, take a look at our code samples on Github.

