Getting a working mobile-SDK key from 2GIS turned out to require a sales-mediated B2B process (Platform Manager subscription, demo keys explicitly excluded from mobile SDK use per their own docs), not a quick self-serve signup. Swapped to osmdroid instead: free, no API key or account, works immediately. CityMapView (replacing DgisMapView/DgisSdkProvider) wraps osmdroid's View-based MapView via AndroidView, forwarding lifecycle events, with markers for the user's location and each nearby place. Configured required OSM tile-usage-policy user agent + app-private tile cache in GuideCityApp. Removed the now-unused DGIS_API_KEY plumbing and the arm64-only ABI filter (osmdroid has no heavy native libs, so it's not needed) — APK is back down to ~19.6MB from ~69MB. Verified: testDebugUnitTest passes, assembleDebug produces a working APK, sent via the Telegram bot (previously blocked by its 50MB limit with the 2GIS build). Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
119 lines
3.6 KiB
Kotlin
119 lines
3.6 KiB
Kotlin
import java.util.Properties
|
|
|
|
plugins {
|
|
alias(libs.plugins.android.application)
|
|
alias(libs.plugins.kotlin.android)
|
|
alias(libs.plugins.kotlin.compose)
|
|
alias(libs.plugins.kotlin.serialization)
|
|
alias(libs.plugins.hilt.android)
|
|
alias(libs.plugins.ksp)
|
|
}
|
|
|
|
val localProperties = Properties().apply {
|
|
val file = rootProject.file("local.properties")
|
|
if (file.exists()) {
|
|
file.inputStream().use { load(it) }
|
|
}
|
|
}
|
|
|
|
fun localProp(key: String, default: String): String =
|
|
(localProperties.getProperty(key) ?: System.getenv(key) ?: default)
|
|
|
|
android {
|
|
namespace = "com.guidecity.app"
|
|
compileSdk = 34
|
|
|
|
defaultConfig {
|
|
applicationId = "com.guidecity.app"
|
|
minSdk = 26
|
|
targetSdk = 34
|
|
versionCode = 1
|
|
versionName = "0.1.0"
|
|
|
|
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
|
|
|
|
buildConfigField(
|
|
"String",
|
|
"API_BASE_URL",
|
|
"\"${localProp("API_BASE_URL", "http://10.0.2.2:8000/")}\"",
|
|
)
|
|
}
|
|
|
|
buildTypes {
|
|
release {
|
|
isMinifyEnabled = false
|
|
proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro")
|
|
}
|
|
}
|
|
|
|
compileOptions {
|
|
sourceCompatibility = JavaVersion.VERSION_17
|
|
targetCompatibility = JavaVersion.VERSION_17
|
|
}
|
|
|
|
kotlinOptions {
|
|
jvmTarget = "17"
|
|
freeCompilerArgs += listOf(
|
|
"-opt-in=androidx.compose.material3.ExperimentalMaterial3Api",
|
|
)
|
|
}
|
|
|
|
buildFeatures {
|
|
compose = true
|
|
buildConfig = true
|
|
}
|
|
|
|
testOptions {
|
|
unitTests {
|
|
// Production code calls android.util.Log for observability; without this,
|
|
// the Android stub jar throws on every such call in plain JVM unit tests.
|
|
isReturnDefaultValues = true
|
|
}
|
|
}
|
|
}
|
|
|
|
dependencies {
|
|
implementation(libs.androidx.core.ktx)
|
|
implementation(libs.androidx.lifecycle.runtime.ktx)
|
|
implementation(libs.androidx.lifecycle.viewmodel.compose)
|
|
implementation(libs.androidx.activity.compose)
|
|
|
|
implementation(platform(libs.androidx.compose.bom))
|
|
implementation(libs.androidx.ui)
|
|
implementation(libs.androidx.ui.graphics)
|
|
implementation(libs.androidx.ui.tooling.preview)
|
|
implementation(libs.androidx.material3)
|
|
implementation(libs.androidx.material.icons.extended)
|
|
implementation(libs.androidx.navigation.compose)
|
|
debugImplementation(libs.androidx.ui.tooling)
|
|
|
|
implementation(libs.hilt.android)
|
|
ksp(libs.hilt.compiler)
|
|
implementation(libs.hilt.navigation.compose)
|
|
|
|
implementation(libs.retrofit.core)
|
|
implementation(libs.retrofit.kotlinx.serialization.converter)
|
|
implementation(libs.okhttp.logging.interceptor)
|
|
implementation(libs.kotlinx.serialization.json)
|
|
|
|
implementation(libs.androidx.room.runtime)
|
|
implementation(libs.androidx.room.ktx)
|
|
ksp(libs.androidx.room.compiler)
|
|
|
|
implementation(libs.androidx.datastore.preferences)
|
|
|
|
implementation(libs.play.services.location)
|
|
implementation(libs.kotlinx.coroutines.play.services)
|
|
|
|
// OpenStreetMap tiles via osmdroid — free, no API key/registration needed.
|
|
implementation(libs.osmdroid.android)
|
|
|
|
testImplementation(libs.junit)
|
|
testImplementation(libs.mockk)
|
|
testImplementation(libs.kotlinx.coroutines.test)
|
|
androidTestImplementation(libs.androidx.test.ext.junit)
|
|
androidTestImplementation(libs.androidx.espresso.core)
|
|
androidTestImplementation(platform(libs.androidx.compose.bom))
|
|
androidTestImplementation(libs.androidx.ui.test.junit4)
|
|
debugImplementation(libs.androidx.ui.test.manifest)
|
|
}
|