This document describes how to build the Intel® RealSense™ SDK 2.0 including headless tools and examples for Android devices.
Read about Android support here.
-
Root your Android device.
-
Download the Native Development Kit (NDK) for Linux to your host machine.
-
Install CMake 3.6.1 or newer.
-
Download ADB to the host machine by typing
sudo apt-get install adb
. -
Clone the latest RealSense™ SDK 2.0 to your host machine.
-
Change the streaming width and height to 480 and 270 respectively in rs-depth and rs-distance examples using Linux text editor.
-
Open Terminal on the host machine, navigate to librealsense root directory and type the following lines:
mkdir build && cd build
cmake .. -DANDROID_ABI=<Application Binary Interface> -DCMAKE_TOOLCHAIN_FILE=<Path to NDK folder>/build/cmake/android.toolchain.cmake -DFORCE_LIBUVC=TRUE
make
Initialize ANDROID_ABI with one of the supported ABIs (
armeabi-v7a
for example).
- When compilation done type the following lines to store the binaries at the same location to easily copy them to your Android device.
mkdir lrs_binaries && cd lrs_binaries
cp ../librealsense2.so ./
cp ../examples/C/color/rs-color ./
cp ../examples/C/depth/rs-depth ./
cp ../examples/C/distance/rs-distance ./
cp ../examples/save-to-disk/rs-save-to-disk ./
cp ../tools/data-collect/rs-data-collect ./
cp ../tools/enumerate-devices/rs-enumerate-devices ./
cp ../tools/fw-logger/rs-fw-logger ./
cp ../tools/terminal/rs-terminal ./
- Connect your Android device to the host machine using USB OTG cable.
- Create new folder and copy the binaries to your Android device using ADB by the following lines:
adb shell mkdir -p /storage/emulated/legacy/lrs_binaries
adb push . /storage/emulated/legacy/lrs_binaries/
- Open ADB Shell and move to Super User mode by the following line:
adb shell su
- Copy the binaries to the internal storage and change their permission to be executables by the following lines:
cp -R /storage/emulated/legacy/lrs_binaries /data/
cd /data/lrs_binaries
chown root:root *
chmod +x *
- Use the USB OTG cable to connect the RealSense camera to your Android device.
- Install Terminal Emulator on your Android device from Google Play Store.
- Open the Terminal Emulator application and type below lines in order to move to Super User mode and run one of the RealSense examples/tools.
su
cd /data/lrs_binaries
./rs-depth
- Streaming Depth data using rs-depth sample on rooted Samsung Galaxy S4 device.