Skip to main content

Gradle Setup

Repository Configuration

Add the required repositories to your settings.gradle.kts:
settings.gradle.kts
dependencyResolutionManagement {
    repositoriesMode.set(RepositoriesMode.PREFER_SETTINGS)
    repositories {
        mavenLocal()       // For local SDK development builds
        google()
        mavenCentral()
        maven { url = uri("https://jitpack.io") }  // Required for transitive deps (android-vad, PRDownloader)
    }
}

Dependencies

Add the RunAnywhere SDK to your module-level build.gradle.kts:
build.gradle.kts (Module: app)
dependencies {
    // Core SDK (required)
    implementation("io.github.sanchitmonga22:runanywhere-sdk-android:0.20.6")

    // LLM + VLM support - llama.cpp backend (~34MB)
    implementation("io.github.sanchitmonga22:runanywhere-llamacpp-android:0.20.6")

    // STT/TTS/VAD support - ONNX backend (~25MB)
    implementation("io.github.sanchitmonga22:runanywhere-onnx-android:0.20.6")
}
Include only the modules you need. Each native module adds to your APK size: - runanywhere-llamacpp-android: ~34MB (for LLM/VLM text generation) - runanywhere-onnx-android: ~25MB (for STT, TTS, and VAD)

Build Configuration

build.gradle.kts (Module: app)
android {
    compileSdk = 35
    defaultConfig {
        minSdk = 26
        targetSdk = 35
    }
    compileOptions {
        sourceCompatibility = JavaVersion.VERSION_17
        targetCompatibility = JavaVersion.VERSION_17
    }
    kotlinOptions {
        jvmTarget = "17"
    }
}

Module Overview

ModuleSizeFeatures
runanywhere-sdk-android~2MBCore SDK, model management, events
runanywhere-llamacpp-android~34MBLLM + VLM (GGUF models)
runanywhere-onnx-android~25MBSTT, TTS, VAD (ONNX models)

Supported Model Formats

FormatExtensionBackendUse Case
GGUF.ggufllama.cppLLM text generation
ONNX.onnxONNX RuntimeSTT, TTS, VAD
ORT.ortONNX RuntimeOptimized STT/TTS

Android Manifest

Add the required permissions to your AndroidManifest.xml:
AndroidManifest.xml
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />

<uses-feature android:name="android.hardware.microphone" android:required="false" />
INTERNET is required for model downloads. RECORD_AUDIO is needed for STT and Voice Pipeline. MODIFY_AUDIO_SETTINGS is needed for TTS audio playback. Runtime permission for RECORD_AUDIO must be requested via ActivityResultContracts.RequestPermission().

ProGuard Rules

If using ProGuard/R8 minification, add these rules:
proguard-rules.pro
-keep class com.runanywhere.sdk.** { *; }
-keepclassmembers class com.runanywhere.sdk.** { *; }

Next Steps

Quick Start

Initialize the SDK and run your first inference →