Docker system to build rcljava for Android and its use on ros2-android apps.
This repo just explains a bit the install procedure. For more info see:
Current environment:
- NDK: android-ndk-r23b
- ABI: arm64-v8a
- Android API Level(minSdkVersion): android-24
Modify Dockerfile file to change these.
ROS2 Humble is selectd for the docker image. Modify repos file for other options.
See this tutorial on installing Docker on your system. Or just type this:
sudo apt update
sudo apt install git apt-transport-https ca-certificates curl software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt update
sudo apt install docker-ce
sudo usermod -aG docker ${USER}
su - ${USER}
git clone https://github.com/TaISLab/ros2-android-build
cd ros2-android-build/
docker build -t ros2java-android-build ./
There is a python script to init library compilation:
cd ros2-android-build/
python3 run.py ./out/soOut ./out/jarOut --srcDir ../src
The script takes up to three arguments:
./out/soOut: Android project folder to copy.jarfiles./out/jarOut: Android project folder to copy.sofiles--srcDir ../src: (Optional) source folder for packages other than ros2 java to be included in your Android app, for example your own message packages.
Usually, .jar files are in folder app/libs/rcljava folder and .so files in app/src/main/jniLibs/arm64-v8a folder from your Android app.
Remember to also add the line implementation fileTree(include: ['*.jar'], dir: 'libs') to dependencies{} of app/build.gradle file.
YasuChiba has a repo with an example project here. This project has the following structure:
app
-libs
- .jar files go here!
- src
- main
- java
- jniLibs
- arm64-v8a
- .so files go here!
- res
- AndroidManifest.xml