47df14c952
A fully local AI assistant for Android powered by Google's Gemma 4 models. Features: - Fully local inference (voice/image/text on-device) - Voice input with Voice Activity Detection - Image understanding with camera/gallery support - Text chat with markdown rendering - Gemma 4 via LiteRT-LM (E2B/E4B variants) - Model download manager - Session management with persistent history - Smart TTS with auto-detect mode - Device RAM info for model selection
141 lines
4.9 KiB
Kotlin
141 lines
4.9 KiB
Kotlin
plugins {
|
|
id("com.android.application")
|
|
id("org.jetbrains.kotlin.android")
|
|
id("org.jetbrains.kotlin.plugin.serialization")
|
|
// KSP removed due to KSP2/Hilt incompatibility - using manual DI instead
|
|
id("org.jetbrains.kotlin.plugin.compose")
|
|
}
|
|
|
|
android {
|
|
namespace = "com.sleepy.agent"
|
|
compileSdk = 35
|
|
|
|
defaultConfig {
|
|
applicationId = "com.sleepy.agent"
|
|
minSdk = 26
|
|
targetSdk = 35
|
|
versionCode = 1
|
|
versionName = "1.0"
|
|
|
|
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
|
|
vectorDrawables {
|
|
useSupportLibrary = true
|
|
}
|
|
}
|
|
|
|
buildTypes {
|
|
release {
|
|
isMinifyEnabled = true
|
|
isShrinkResources = true
|
|
proguardFiles(
|
|
getDefaultProguardFile("proguard-android-optimize.txt"),
|
|
"proguard-rules.pro"
|
|
)
|
|
}
|
|
}
|
|
|
|
// Only ship arm64-v8a (modern phones). Saves ~62MB!
|
|
defaultConfig {
|
|
ndk {
|
|
abiFilters += listOf("arm64-v8a")
|
|
}
|
|
}
|
|
compileOptions {
|
|
sourceCompatibility = JavaVersion.VERSION_17
|
|
targetCompatibility = JavaVersion.VERSION_17
|
|
}
|
|
kotlin {
|
|
compilerOptions {
|
|
jvmTarget = org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_17
|
|
}
|
|
}
|
|
buildFeatures {
|
|
compose = true
|
|
}
|
|
composeOptions {
|
|
kotlinCompilerExtensionVersion = "1.5.14"
|
|
}
|
|
packaging {
|
|
resources {
|
|
excludes += "/META-INF/{AL2.0,LGPL2.1}"
|
|
}
|
|
}
|
|
}
|
|
|
|
dependencies {
|
|
// Core Android
|
|
implementation("androidx.core:core-ktx:1.13.1")
|
|
implementation("androidx.lifecycle:lifecycle-runtime-ktx:2.8.2")
|
|
implementation("androidx.activity:activity-compose:1.9.0")
|
|
|
|
// Compose BOM - Latest stable
|
|
implementation(platform("androidx.compose:compose-bom:2024.12.01"))
|
|
implementation("androidx.compose.ui:ui")
|
|
implementation("androidx.compose.ui:ui-graphics")
|
|
implementation("androidx.compose.ui:ui-tooling-preview")
|
|
implementation("androidx.compose.material3:material3")
|
|
implementation("androidx.compose.material:material-icons-extended")
|
|
|
|
// Navigation
|
|
implementation("androidx.navigation:navigation-compose:2.7.7")
|
|
|
|
// CameraX - Latest stable
|
|
val cameraxVersion = "1.3.4"
|
|
implementation("androidx.camera:camera-core:$cameraxVersion")
|
|
implementation("androidx.camera:camera-camera2:$cameraxVersion")
|
|
implementation("androidx.camera:camera-lifecycle:$cameraxVersion")
|
|
implementation("androidx.camera:camera-view:$cameraxVersion")
|
|
implementation("androidx.camera:camera-video:$cameraxVersion")
|
|
|
|
// Room removed - using in-memory storage instead due to KSP2 issues
|
|
|
|
// Ktor Client - Latest stable
|
|
val ktorVersion = "2.3.11"
|
|
implementation("io.ktor:ktor-client-core:$ktorVersion")
|
|
implementation("io.ktor:ktor-client-okhttp:$ktorVersion")
|
|
implementation("io.ktor:ktor-client-content-negotiation:$ktorVersion")
|
|
implementation("io.ktor:ktor-serialization-kotlinx-json:$ktorVersion")
|
|
implementation("io.ktor:ktor-client-logging:$ktorVersion")
|
|
|
|
// DataStore - Latest stable
|
|
implementation("androidx.datastore:datastore-preferences:1.1.1")
|
|
implementation("androidx.datastore:datastore:1.1.1")
|
|
|
|
// Kotlinx Serialization
|
|
implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.6.3")
|
|
|
|
// LiteRT-LM for Gemma 4 inference (Google's current recommendation)
|
|
implementation("com.google.ai.edge.litertlm:litertlm-android:0.10.0") {
|
|
exclude(group = "org.jetbrains.kotlin", module = "kotlin-stdlib")
|
|
exclude(group = "org.jetbrains.kotlin", module = "kotlin-stdlib-jdk8")
|
|
exclude(group = "org.jetbrains.kotlin", module = "kotlin-reflect")
|
|
}
|
|
|
|
// LiteRT base library
|
|
implementation("com.google.ai.edge.litert:litert:2.1.0") {
|
|
exclude(group = "org.jetbrains.kotlin", module = "kotlin-stdlib")
|
|
}
|
|
|
|
// Note: MediaPipe removed - using LiteRT-LM for all inference
|
|
|
|
// Coroutines
|
|
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-android:1.8.1")
|
|
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-play-services:1.8.1")
|
|
|
|
// WorkManager (for background tasks)
|
|
implementation("androidx.work:work-runtime-ktx:2.9.0")
|
|
|
|
// Markdown rendering with tables and code blocks
|
|
implementation("com.github.jeziellago:compose-markdown:0.5.2")
|
|
|
|
// Testing
|
|
testImplementation("junit:junit:4.13.2")
|
|
testImplementation("org.jetbrains.kotlinx:kotlinx-coroutines-test:1.8.1")
|
|
androidTestImplementation("androidx.test.ext:junit:1.1.5")
|
|
androidTestImplementation("androidx.test.espresso:espresso-core:3.5.1")
|
|
androidTestImplementation(platform("androidx.compose:compose-bom:2024.06.00"))
|
|
androidTestImplementation("androidx.compose.ui:ui-test-junit4")
|
|
debugImplementation("androidx.compose.ui:ui-tooling")
|
|
debugImplementation("androidx.compose.ui:ui-test-manifest")
|
|
}
|