Android Development Environment
Contents
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
Download and install the new 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.
> 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
- Start a roscore on your machine
- Launch the app on your device and enter your machine's ip when prompted
- Start the image viewer on your machine
> 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.