How to use ROS2 on Android

Yasuhira Chiba
1 min readMar 20, 2022

--

ros2_java (https://github.com/ros2-java/ros2_java) is the java wrapper for ROS2. This project enables us to use ROS2 on Android. However, it is a little bit hard to build ros2 java and use it in your Android project. This article explains how to build and use ros2 on Android.

Build

You need docker on your system. (I only tested on Ubuntu.)

  1. Clone this project
  2. Run following commands
docker build -t ros2java-android-build ./

python3 run.py ./out/soOut ./out/jarOut

3. Check the results

.jar file and .so files are copied into outdirectory.

Use

  1. Create a new Android project
  2. Copy .so files into app/src/main/jniLibs/arm64-v8a/
  3. Copy .jar files into app/libs

Example app: https://github.com/YasuChiba/ros2-android-test-app

— — — — —

Currently, I’m working on porting ROS-Mobile-Android to ROS2. (ROS2-Mobile-Android)

ROS-Mobile-Android is the Android app to publish/subscribe ROS topics and display them like rviz. To port this app to ROS2, I’m utilizing my ros-android-build tool.

--

--