Skip to main content
The Moss Android SDK brings semantic search to Android apps. It is a Kotlin library (dev.usemoss.moss) over the native libmoss runtime: an index loads from Moss once and is then queried on the device, with no network call at query time.

Requirements

  • Android 7.0 (API 24) or later
  • An arm64-v8a phone or emulator image. The SDK has no x86_64 or 32-bit build.
  • Kotlin, or Java with org.jetbrains.kotlin:kotlin-stdlib added to the app

Install

The SDK ships as a file AAR on the android-sdk-v<version> releases of usemoss/moss. Download it into your app module:
Then add it in app/build.gradle.kts:
The AAR brings the INTERNET permission and the R8 rules the SDK needs.
The Android SDK is distributed only as a GitHub release AAR. It is not published to Maven Central. Add it to your app module: a library module that builds its own AAR cannot depend on a local AAR.

Quick start

Every blocking call rejects the main thread with a MossException, so call them from Dispatchers.IO (with kotlinx-coroutines-android) or a background executor:
loadIndex downloads the index once and caches it in the app’s cache directory, and every query after that runs on the device. Querying an index that is not loaded throws MossException.NotFound.

Notes

  • Keep one MossClient per process. A second one cannot start while another is live or still closing.
  • On a device where the native library cannot load, such as an x86_64 emulator image, every call throws MossException.
  • close() returns at once and frees the native client in the background.