Android series overview
These tutorials walk you through deploying Edge Impulse models on Android, from running inference on static test data to real-time camera and audio apps to hardware-accelerated inference on Qualcomm’s NPU. All examples use the Android NDK to call the Edge Impulse C++ SDK directly from Kotlin or Java, giving you low-latency, fully on-device inference without a network connection. If you’re new to Edge Impulse, complete a model training tutorial first to train and export a model, then come back here to deploy it to Android.Prerequisites
Before starting any tutorial in this series, make sure you have the following:- 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, CMake 3.22.1
- Basic familiarity with Android development
How the examples work
All examples in this series share the same underlying architecture. The Edge Impulse C++ SDK handles signal processing and neural network execution in native code, while your Kotlin or Java app manages the UI, sensor access, and data capture. A JNI bridge innative-lib.cpp connects the two layers, keeping the performance-critical inference path in C++ while letting you build a standard Android UI around it.
See the Android NDK documentation for more on integrating native C++ into Android apps.
Quick start
All examples live in the same repository. Clone it once, then navigate into whichever example you want to run:Tutorials
Step 0 — Collect your dataset
Android data collector
Collect phone sensor data, Wear OS heart‑rate / IMU / GPS, camera images, BLE‑relayed results from a Zephyr device, and USB OTG serial data from Arduino boards (including IMU + camera from the Nano 33 BLE Sense + TinyML Kit) — all in one app, with optional voice‑controlled capture. Upload directly to your Edge Impulse project. Skip this step if you already have a dataset in Studio.
Deploy a trained model
Static buffer inference
Run inference on hardcoded test data. The simplest starting point, with no sensors required.
Keyword spotting
Recognize wake words and voice commands from your phone’s microphone in real time.
Camera inference
Run object detection or image classification on a live camera feed using Camera2.
WearOS motion inference
Classify motion data from a WearOS device’s accelerometer and gyroscope.
QNN hardware acceleration
Speed up inference 10× or more using Qualcomm’s Hexagon NPU on Snapdragon devices.
QNN speech to image GenAI
Generate images from spoken prompts using a quantized GenAI pipeline running entirely on-device.
Common deployment workflow
Every deployment tutorial in this series (everything except the Android data collector, which is a data‑acquisition app and does not embed a model) follows the same five‑step process to go from a trained Edge Impulse model to a running Android app.-
Export your model: In Edge Impulse Studio, go to Deployment → Android (C++ library) and click Build. Download the
.ziparchive. -
Download TensorFlow Lite libraries: Each example includes a script that fetches the required TFLite runtime binaries:
-
Copy your model files: Extract the downloaded
.zipand copy all files intoapp/src/main/cpp/. Don’t overwrite the existingCMakeLists.txt; the project’s build configuration is already set up for you. -
Update the test features: Open
native-lib.cppand paste in the raw features from one of your test samples in Studio. This lets you verify the model produces correct output before wiring up a live sensor. - Build and run: Open the project in Android Studio, click Build → Make Project, then run it on a device or emulator.
Platform support
The minimum supported Android API level is 24 for the deployment examples; the build target is API 35. The Android data collector requires API 28 or later because the bundled full TensorFlow Lite runtime uses
aligned_alloc.