Skip to main content
This tutorial shows how to run an Edge Impulse model on Android using hardcoded test data with no sensors required. It’s a useful starting point before moving on to camera, audio, or motion input.

What you’ll build

A basic Android app that:
  • Loads a C++ model via Android NDK
  • Runs inference on static test features
  • Displays classification results

Prerequisites

  • Trained Edge Impulse model
  • Android Studio with NDK and CMake installed
  • Basic familiarity with Android development

1. Clone the repository

2. Download TensorFlow Lite libraries

3. Export your model

  1. In Edge Impulse Studio, go to Deployment
  2. Select Android (C++ library)
  3. Click Build and download the .zip

4. Integrate the model

  1. Extract the downloaded .zip file
  2. Copy all files to:
Your structure should look like:

5. Add test features

  1. In Studio, go to Model testing
  2. Click on a test sample
  3. Copy the raw features
  4. Paste into native-lib.cpp:

6. Build and run

  1. Open the project in Android Studio
  2. BuildMake Project
  3. Run on a device or emulator
You should see classification results on screen.

How it works

Native inference

Java/Kotlin bridge

Troubleshooting

Cause: Model files not copied correctlySolution:
  • Ensure all folders (edge-impulse-sdk, model-parameters, tflite-model) are in app/src/main/cpp/
  • Don’t replace the existing CMakeLists.txt
Cause: Native library not loadedSolution:
  • Verify System.loadLibrary("test_cpp") matches your library name
  • Check Build output for compilation errors
Cause: Test features don’t match model inputSolution:
  • Copy features from Studio’s Model Testing page
  • Ensure feature count matches model input size
  • Check feature order (x, y, z for accelerometer, etc.)

Next steps