[Documentation] [TitleIndex] [WordIndex

(!) Please ask about problems and questions regarding this tutorial on answers.ros.org. Don't forget to include in your question the link to this page, the versions of your OS & ROS, and also add appropriate tags.

Installation - Android Studio Development Environment

Description: Develop from Android Studio without a ROS Environment!

Keywords: android studio installation

Tutorial Level: BEGINNER

Overview

/!\ This is a No Ros Zone!!!

This tutorial shows how to setup develop using android studio + sdk without a ros environment. This means no installation of ros necessary, no sourcing of setup.bash, and no catkin packages. You can focus on a single app using just the studio, the gradle backend and some gradle-groovy logic connecting you to our maven repository.

Useful for the non-ros programmer!

New Project

Start a new project in android studio. If you click on the panel on the left to open up the Project window, you will see a typical gradle layout.

+ MyApplicationProject
 + .idea
 + gradle
 + MyApplication
  - build.gradle
  - ...
 - build.gradle
 - settings.gradle
 - gradlew
 - ...

Ros Artifacts

You will need to link your project to the required ros artifacts - these will typically be the rosjava-android libraries and the message artifacts.

In the sub project's build.gradle you will need to tell the project where it can find the rosjava-android artifacts:

repositories {
    maven {
        url 'https://github.com/rosjava/rosjava_mvn_repo/raw/master'
    }
    mavenCentral()

with dependencies on various java/android libraries listed in the following style:

dependencies {
    compile 'org.ros.android_core:android_gingerbread_mr1:[0.1,0.2)'
    compile 'org.ros.android_core:android_honeycomb_mr2:[0.1,0.2)'
    compile 'org.ros.rosjava_core:rosjava:[0.1,0.2)'
}

If you're getting errors talking about an ill-advised usage of a core class (javax.*), then read this answer for a workaround until the issue is better known.

What Next?

The next time you build the project, it will download the required dependencies into your maven local directory (usually ~/.m2/repositories) and you can get started using rosjava classes in your code.


2020-02-22 12:31