Skip to main content
This tutorial runs an Edge Impulse model on Android against hardcoded test features, so you can check the JNI bridge and inference loop before you add camera, audio, or motion input.

What you’ll build

An Android app that:
  • Loads the Edge Impulse C++ library through the Android NDK
  • Runs inference on static test features
  • Displays the classification results

Prerequisites

  • A trained Edge Impulse model
  • Android Studio with the NDK and CMake installed

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 file.

4. Integrate the model

Extract the downloaded .zip file and copy its contents, except CMakeLists.txt, into example_static_buffer/app/src/main/cpp/. The folder then looks like this:

5. Add test features

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

6. Build and run

  1. Open the project in Android Studio.
  2. Select Build -> Make Project.
  3. Run the app on a device or emulator.
The app shows the classification results on screen.

How it works

Native inference

Java/Kotlin bridge

Troubleshooting

The model files aren’t in the right place. Check that edge-impulse-sdk/, model-parameters/, and tflite-model/ are all in app/src/main/cpp/, and that you kept the existing CMakeLists.txt.
The native library didn’t load. Check that System.loadLibrary("test_cpp") matches your library name, and look for compilation errors in the Build output.
The test features don’t match the model input. Copy the features from the Model testing page, and check that the feature count matches the model’s input size and that the axis order matches your training data.

Next steps