Prerequisites
- An Edge Impulse account with a trained model
- Android Studio Ladybug 2024.2.2 or later
- Android SDK tools: API 35, NDK 27.0.12077973, and CMake 3.22.1
How the examples work
The Edge Impulse C++ SDK runs signal processing and the neural network in native code. Your Kotlin or Java app handles the UI, sensor access, and data capture. A JNI bridge innative-lib.cpp connects the two layers. See the Android NDK documentation for more on native code in Android apps.
Get the examples
All examples live in one repository:Tutorials
Collect a dataset
Android data collector
Upload phone sensor data, camera images, Wear OS heart rate, IMU, and GPS, BLE data from a Zephyr device, and USB OTG data from Arduino boards to your Edge Impulse project. Supports voice-controlled capture.
Deploy a trained model
Static buffer inference
Run inference on hardcoded test data, with no sensors required.
Keyword spotting
Detect wake words and voice commands from the phone’s microphone.
Camera inference
Run image classification, object detection, or visual anomaly detection on a live camera feed.
Motion inference on Wear OS
Classify motion from a Wear OS watch’s accelerometer and gyroscope.
QNN hardware acceleration
Speed up inference with the Hexagon NPU on Qualcomm Snapdragon devices.
QNN speech to image
Generate images from spoken prompts with Whisper and Stable Diffusion on the Hexagon NPU.
More ways to deploy
AR/XR factory floor (Unity + Quest 3)
Run an Edge Impulse FOMO model inside a Unity XR app on Meta Quest 3 or 3S to inspect bottle caps on a virtual conveyor.
ExecuTorch (PyTorch to Android)
Deploy PyTorch models to Android with ExecuTorch instead of the C++ SDK.
Common deployment workflow
Each deployment tutorial in this series follows the same steps. The Android data collector doesn’t embed a model, so it doesn’t use them.-
Export your model. In Edge Impulse Studio, go to Deployment, select Android (C++ library), click Build, and download the
.zipfile. -
Download the TensorFlow Lite libraries. Each example includes a script that fetches the TFLite runtime:
-
Copy your model files. Extract the
.zipfile and copy its contents intoapp/src/main/cpp/. Keep the existingCMakeLists.txt, which already has the project’s build configuration. -
Update the test features. Paste the raw features from one of your test samples into
native-lib.cpp, so you can check the model’s output before you connect a live sensor. - Build and run. Open the project in Android Studio, select Build -> Make Project, and run it on a device or emulator.
Platform support
The deployment examples support Android API 24 and later, and build against API 35. The Android data collector needs API 28 or later because its TensorFlow Lite runtime uses
aligned_alloc.