Build Intel RealSense SDK headless tools and examples

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.


  1. Root your Android device.
  2. Download the Native Development Kit (NDK) for Linux to your host machine.
  3. Install CMake 3.6.1 or newer.
  4. Download ADB to the host machine by typing sudo apt-get install adb.
  5. Clone the latest Intel RealSense SDK 2.0 to your host machine.
  6. Change the streaming width and height to 480 and 270 respectively in rs-depth and rs-distance examples using Linux text editor.
  7. 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

Initialize ANDROID_ABI with one of the supported ABIs (armeabi-v7a for example).
8. 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 ../ ./
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 ./
  1. Connect your Android device to the host machine using USB OTG cable.
  2. 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/
  1. Open ADB Shell and move to Super User mode by the following line:
adb shell su
  1. 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 *
  1. Use the USB OTG cable to connect the RealSense camera to your Android device.
  2. Install Terminal Emulator on your Android device from Google Play Store.
  3. 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.
cd /data/lrs_binaries

Expected Output

Streaming Depth data using rs-depth sample on rooted Samsung Galaxy S4 device.