This example shows a simple Android UI (Kotlin + Compose) that calls a Rust
JNI bridge which runs an AutoAgents BasicAgent backed by autoagents-llamacpp.
android/- Android Studio project (UI + JNI bridge usage)src/lib.rs- Rust JNI bridge that calls the AutoAgents llama.cpp backend
Use cargo-ndk to build the shared library for Android:
cargo install cargo-ndk
cargo ndk -t arm64-v8a -o android/app/src/main/jniLibs -P 29 build -p agent_android --releaseThis produces libagent_android.so under android/app/src/main/jniLibs/arm64-v8a/.
- Open
examples/agent_android/androidin Android Studio. - Run the app and send a prompt.
- Enable Developer Options and USB debugging on the device.
- Verify the device is detected:
adb devices
- Build the Rust JNI library (set your NDK path):
export ANDROID_NDK=/home/<USERNAME>/Android/Sdk/ndk/29.0.14206865 export ANDROID_API_LEVEL=29 export ANDROID_PLATFORM=android-29 cargo ndk -t arm64-v8a -P 29 -o android/app/src/main/jniLibs build -p agent_android --release
- Install the Android app to the connected device:
cd android ./gradlew installDebug - Open the app and set the model path (for example,
/data/local/tmp/model.gguf).
NOTE: This app is completely vibe-coded!