Intel® RealSense™ Cross Platform API
Intel Realsense Cross-platform API
Build RealSense SDK Samples for Android OS

This document describes how to build the Intel® RealSense™ SDK 2.0 including headless tools and examples for Android devices.

Read about Android support ./Android.md "here".

Instructions

  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 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
    make

Initialize ANDROID_ABI with one of the supported ABIs (armeabi-v7a for example).

  1. 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 ./
  2. Connect your Android device to the host machine using USB OTG cable.
  3. Create new folder and copy the binaries to your Android device using ADB by the following lines:
    adb shell mkdir /storage/emulated/legacy/lrs_binaries
    adb push . /storage/emulated/legacy/lrs_binaries/
  4. Open ADB Shell and move to Super User mode by the following line:
    adb shell su
  5. 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 *
  6. Use the USB OTG cable to connect the RealSense camera to your Android device.
  7. Install Terminal Emulator on your Android device from Google Play Store.
  8. 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

Expected Output