[Documentation] [TitleIndex] [WordIndex

Android Development Environment

Overview

The new android development (hydro and beyond) is based on google's Android Gradle Plugin & Android Studio which will be replacing the ADT & Eclipse.

The following instructions get you set up with the rosjava_core and android_core stacks in a ros environment. Adding additional stacks is simply a matter of extending the rosinstallers or chaining a new catkin workspace.

Installation

Android Studio & SDK

Debs

You'll need catkin, ros (for the setup.bash variables) and a few message packages to ensure it all compiles. Ensure you include any other msg packages you are likely to use in your android applications.

> sudo apt-get install ros-hydro-catkin ros-hydro-ros ros-hydro-common-msgs

You will also need wstool.

> sudo apt-get install python-wstool

or when that is not possible, fall back to pip:

> sudo pip install -U wstool

Sources

Set up some chained catkin workspaces to modularise the builds and save some compile times.

Why catkin?

The stacks have been very simply catkinized - essentially all the catkinizing is doing is sequencing the progress of stack builds correctly so you can do it in one shot. Under the hood it is just calling out to gradle in each stack.

Once everything is compiled, you can then simply dive into the sources and just call on gradle from the command line OR utilise android studio (it imports native gradle projects and couples with them well) itself for further compiles.

Clean Environment

Make sure you have a clean shell with no previous ROS environment variables set. If you don't it will confuse the chained catkin workspaces, which will ultimately fail when trying to compile.

> mkdir -p ~/rosjava
> wstool init -j4 ~/rosjava/src https://raw.github.com/rosjava/rosjava/hydro/rosjava.rosinstall
> source /opt/ros/hydro/setup.bash
> cd ~/rosjava
> catkin_make

Now the source android workspace:

> mkdir -p ~/android
> wstool init -j4 ~/android/src https://raw.github.com/rosjava/rosjava/hydro/android_core.rosinstall
# or if you want the android_apps/android remocons repos as well:
# wstool init -j4 ~/android/src https://raw.github.com/rosjava/rosjava/hydro/android_apps.rosinstall
> source ~/rosjava/devel/setup.bash
> cd ~/android
> catkin_make

Now import your projects into android studio and use the IDE from here!

Testing an App

Android

Install the android_tutorial_camera app via Android Studio to your device. Refer to the Android Studio notes for instructions on how to do this and other things that will mercilessly coerce Android Studio into aligning your evil plans. Feel free to add to these.

Launch the app and connect to a pc master configured in the following way.

PC

> source ~/android/devel/setup.bash

> rosrun image_view image_view image:=camera/image _image_transport:=compressed

Creating an App

Use rosjava_tools/hydro, it has a couple of catkin_create_xxx scripts which are useful.


2024-11-23 17:54