examples/android/RunAnywhereAI/README.md
A production-ready reference app for the RunAnywhere Kotlin SDK. Chat, speech, vision, voice agents, RAG, and model management—all running on-device with privacy-first, offline-capable inference.
| Item | Minimum |
|---|---|
| Android Studio | Latest stable (Ladybug or newer recommended) |
| Android SDK | API 24+ (Android 7.0); compile/target SDK 37 |
| JDK | 17 |
| NDK & CMake | As required by the repo root native build scripts |
| Disk space | Several GB for native builds and downloaded AI models |
| Device | ARM64 physical device recommended; emulator supported for most features |
Export ANDROID_HOME and ANDROID_NDK_HOME before building native libraries.
Important: This sample consumes four local AARs from
libs/(core, LlamaCPP, ONNX, QHexRT). A clean clone must build native libraries and stage SDK artifacts before the app will compile.
git clone https://github.com/RunanywhereAI/runanywhere-sdks.git
cd runanywhere-sdks/examples/android/RunAnywhereAI
From the example directory, build the Android native core for your target ABI:
../../../scripts/build/build-core-android.sh arm64-v8a
This produces the JNI libraries the Kotlin SDK packages expect. Re-run this step after any change to the C++ layer in runanywhere-commons.
libs/./scripts/stage-sdk-aars.sh debug
This builds the four Kotlin SDK modules (core, LlamaCPP, ONNX, QHexRT) against the staged natives and copies deterministic AAR names into libs/. Run again after SDK or native changes.
./scripts/verify.sh
Or open the project in Android Studio and run the app configuration, or install from the command line:
./gradlew :app:installDebug
| Change | Action |
|---|---|
| C++ / commons | Re-run build-core-android.sh, then stage-sdk-aars.sh |
| Kotlin SDK | Re-run stage-sdk-aars.sh |
| App UI only | Rebuild in Android Studio or ./gradlew :app:assembleDebug |
| Feature | Description |
|---|---|
| AI Chat | Streaming LLM conversations with analytics and thinking-mode support |
| Speech-to-Text | Batch and live transcription via Sherpa-ONNX / Whisper |
| Text-to-Speech | Neural Piper voices and system TTS fallback |
| Voice Assistant | Full STT → LLM → TTS pipeline |
| Vision (VLM) | Camera and image understanding |
| RAG | Document ingestion and on-device Q&A |
| Model Management | Download, load, unload, and delete models |
| Storage | Usage overview and cache cleanup |
| Solutions | YAML pipeline demos synced from shared catalog |
| Offline | Inference runs locally after models are downloaded |
On supported Qualcomm Hexagon NPU hardware, the app can register the QHexRT backend for accelerated inference. The QHexRT AAR is included in the standard four-AAR staging flow.
To test private runanywhere/*_HNPU model bundles:
The token is passed through the SDK at runtime; it is not stored in source, assets, or logs. Private QHexRT release and device-suite workflows live in a separate checkout—see your internal QHexRT documentation if you maintain that stack.
RunAnywhereAI/
├── app/src/main/java/com/runanywhere/runanywhereai/
│ ├── RunAnywhereApplication.kt # SDK init and backend registration
│ ├── ui/screens/ # Feature screens (chat, voice, vision, …)
│ ├── ui/navigation/ # Compose navigation
│ ├── ui/theme/ # Material 3 theming (#FF6900 brand)
│ └── data/ # Model catalog, settings repositories
├── libs/ # Staged SDK AARs (not committed on clean clone)
├── scripts/
│ ├── stage-sdk-aars.sh # Build and copy AARs into libs/
│ ├── verify.sh # Strict debug APK build gate
│ └── smoke.sh # Fast SDK API coverage check
└── README.md
The app depends on local AARs rather than Maven coordinates so SDK changes in the monorepo are immediately testable.
| Symptom | Fix |
|---|---|
Missing libs/*.aar | Run ./scripts/stage-sdk-aars.sh debug |
| Native link errors after commons changes | Re-run ../../../scripts/build/build-core-android.sh arm64-v8a, then restage AARs |
| Gradle dependency verification failures | Ensure all four AARs are present; run ./scripts/verify.sh for the exact gate |
| QHexRT / NPU models unavailable | Confirm device support and that the QHexRT AAR was staged; HNPU bundles require a saved HF token |
| Out of memory during native build | Close other Gradle daemons; the repo recommends limited workers for SDK builds |
For a quick static check without a full compile:
./scripts/smoke.sh
| Resource | Link |
|---|---|
| Kotlin SDK | sdk/runanywhere-kotlin/README.md |
| iOS example | examples/ios/RunAnywhereAI |
| React Native example | examples/react-native/RunAnywhereAI |
| Flutter example | examples/flutter/RunAnywhereAI |
| Play Store | com.runanywhere.runanywhereai |
| Discord | discord.gg/N359FBbDVd |
| Issues | GitHub Issues |
| [email protected] |
This project is licensed under the RunAnywhere License (Apache 2.0 based, with additional commercial-use terms). See LICENSE for details.