build.gradle.kts
| 1 | plugins { |
| 2 | // AGP 9 has Kotlin built in. |
| 3 | id("com.android.application") version "9.4.1" |
| 4 | } |
| 5 | |
| 6 | android { |
| 7 | namespace = "org.opentracker" |
| 8 | compileSdk = 36 |
| 9 | |
| 10 | defaultConfig { |
| 11 | applicationId = "org.opentracker" |
| 12 | // Android 12: GNSS batching and the modern LocationRequest. |
| 13 | minSdk = 31 |
| 14 | targetSdk = 36 |
| 15 | versionCode = 1 |
| 16 | versionName = "0.1.0" |
| 17 | } |
| 18 | |
| 19 | // Without ANDROID_KEYSTORE, assembleRelease builds an unsigned APK. |
| 20 | val keystore = providers.environmentVariable("ANDROID_KEYSTORE").orNull |
| 21 | val releaseSigning = keystore?.let { |
| 22 | signingConfigs.create("release") { |
| 23 | storeFile = file(it) |
| 24 | storePassword = providers.environmentVariable("ANDROID_KEYSTORE_PASSWORD").get() |
| 25 | keyAlias = providers.environmentVariable("ANDROID_KEY_ALIAS").get() |
| 26 | // PKCS12 has one password for the store and the key. |
| 27 | keyPassword = storePassword |
| 28 | } |
| 29 | } |
| 30 | |
| 31 | buildTypes { |
| 32 | debug { |
| 33 | applicationIdSuffix = ".debug" |
| 34 | // The emulator reaches a dev server on the host as http://10.0.2.2:8080. |
| 35 | manifestPlaceholders["cleartext"] = "true" |
| 36 | } |
| 37 | release { |
| 38 | isMinifyEnabled = false |
| 39 | manifestPlaceholders["cleartext"] = "false" |
| 40 | signingConfig = releaseSigning |
| 41 | } |
| 42 | } |
| 43 | |
| 44 | compileOptions { |
| 45 | sourceCompatibility = JavaVersion.VERSION_21 |
| 46 | targetCompatibility = JavaVersion.VERSION_21 |
| 47 | } |
| 48 | |
| 49 | lint { |
| 50 | disable += setOf( |
| 51 | // Upgrades are a decision, not a lint finding. |
| 52 | "OldTargetApi", |
| 53 | "GradleDependency", |
| 54 | "AndroidGradlePluginVersion", |
| 55 | "NewerVersionAvailable", |
| 56 | ) |
| 57 | warningsAsErrors = true |
| 58 | } |
| 59 | |
| 60 | testOptions { |
| 61 | unitTests.isReturnDefaultValues = true |
| 62 | } |
| 63 | } |
| 64 | |
| 65 | dependencies { |
| 66 | implementation("androidx.browser:browser:1.10.0") |
| 67 | // Must match the Kotlin version that AGP bundles: ./gradlew :app:buildEnvironment | grep kotlin-gradle-plugin |
| 68 | testImplementation("org.jetbrains.kotlin:kotlin-test-junit:2.2.10") |
| 69 | } |
| 70 |