Note: This tutorial assumes that you have completed the previous tutorials: Installation.
(!) Please ask about problems and questions regarding this tutorial on Don't forget to include in your question the link to this page, the versions of your OS & ROS, and also add appropriate tags.

Create a new app

Description: This tutorial shows you how to create a new Android application for your TurtleBot

Tutorial Level: BEGINNER

Prepare your environment

Go back to the workspace you created on previous tutorial and source the setup file that rosinstall created:

> source ~/android/setup.bash
  • Note: Remember that the second command must be executed every time you work on this workspace.

Create the new app

Note: This section adaptation of android_core documentation, section 6. If you find any problem while trying what follows, refer to the original in search of changes or additional hints.

1. Go to the directory where you want to create your Android app. Here we'll assume that you're adding an app to the turtlebot_android repo:

roscd turtlebot_android

If instead you want to create your own directory of apps, copy build.gradle and settings.gradle from turtlebot_android into your directory, then edit settings.gradle to enumerate your projects. Check android_core documentation, section 5 for more details.

2. Create an Android app in the standard way, e.g.:

android create project --target android-17 --path ./myproject --package com.mydomain.myproject --activity MainActivity

3. Add the android library dependencies (e.g. android_gingerbread_mr1, turtlebot_android_core_components) to your manifest.xml

  <depend package="android_gingerbread_mr1"/>
  <depend package="turtlebot_android_core_components"/>

Also add an export flag if your project is a library:

    <android library="true"/>

4. Add your new project to the list that gradle will build by editing settings.gradle and adding an include line, e.g.:

include 'myproject'

5. Configure your stack (this re-generates all the files with dependency information from your manifests:

> cd ~/android/turtlebot_android
> ./

6. Build your app:

cd myproject
../gradlew debug

Eclipse configuration

If you want to use Eclipse to develop your application, take a look at the android_core documentation, section 7.

Execute your app

Probably you are rearing to test your app, right? Just procceed as explained on the previous tutorial, section 6 and feel proud of your creation.

Wiki: turtlebot_android/Tutorials/groovy/Create a new app (last edited 2013-04-28 08:20:18 by DanielStonier)