Skip to content

Commit abb6fc5

Browse files
joreillyclaude
andcommitted
Update to AGP 9.1.1 / Kotlin 2.4.10 baseline
Bring GalwayBus in line with the other KMP samples: Kotlin 2.4.10, AGP 9.1.1 (Gradle 9.5.0), KSP 2.3.10, coroutines 1.11.0, ktor 3.5.1, koin 4.2.2, serialization 1.11.0, KMP-NativeCoroutines 1.0.5. AGP 9 no longer allows com.android.library alongside the Kotlin Multiplatform plugin, so SharedCode moves to com.android.kotlin.multiplatform.library with its Android config nested under kotlin { android { } }, and android-app drops kotlin("android") in favour of AGP's built-in Kotlin. Also handle AGP 9 default changes: proguard-android-optimize.txt is now required, and resValues must be explicitly enabled for the Maps API key. Fix stale macosMain source that still referenced SQLDelight 1.x (com.squareup) and the removed AppleSettings API, so the macOS target compiles again. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
1 parent c33a2fe commit abb6fc5

7 files changed

Lines changed: 32 additions & 43 deletions

File tree

SharedCode/build.gradle.kts

Lines changed: 8 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import org.jetbrains.kotlin.gradle.dsl.JvmTarget
77
plugins {
88
kotlin("multiplatform")
99
id("kotlinx-serialization")
10-
id("com.android.library")
10+
id("com.android.kotlin.multiplatform.library")
1111
id("app.cash.sqldelight")
1212
id("com.google.devtools.ksp")
1313
id("com.rickclephas.kmp.nativecoroutines")
@@ -17,23 +17,8 @@ plugins {
1717
version = "1.0"
1818

1919

20-
android {
21-
compileSdk = libs.versions.compileSdk.get().toInt()
22-
sourceSets["main"].manifest.srcFile("src/androidMain/AndroidManifest.xml")
23-
defaultConfig {
24-
minSdk = libs.versions.minSdk.get().toInt()
25-
26-
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
27-
}
28-
compileOptions {
29-
sourceCompatibility = JavaVersion.VERSION_17
30-
targetCompatibility = JavaVersion.VERSION_17
31-
}
32-
namespace = "com.surrus.galwaybus.lib"
33-
}
34-
35-
3620
kotlin {
21+
jvmToolchain(17)
3722
applyDefaultHierarchyTemplate()
3823

3924
listOf(
@@ -47,7 +32,12 @@ kotlin {
4732
}
4833

4934
macosX64("macos")
50-
androidTarget()
35+
36+
android {
37+
namespace = "com.surrus.galwaybus.lib"
38+
compileSdk = libs.versions.compileSdk.get().toInt()
39+
minSdk = libs.versions.minSdk.get().toInt()
40+
}
5141
jvm()
5242

5343
sourceSets {

SharedCode/src/macosMain/kotlin/common/Platform.kt

Lines changed: 0 additions & 10 deletions
This file was deleted.
Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,19 @@
11
package com.surrus.galwaybus.common.di
22

3-
import com.russhwolf.settings.AppleSettings
4-
import com.russhwolf.settings.ExperimentalSettingsApi
3+
import app.cash.sqldelight.driver.native.NativeSqliteDriver
4+
import com.russhwolf.settings.NSUserDefaultsSettings
55
import com.russhwolf.settings.ObservableSettings
6+
import com.surrus.galwaybus.db.MyDatabase
67
import org.koin.dsl.module
78
import platform.Foundation.NSUserDefaults
89

9-
@OptIn(ExperimentalSettingsApi::class)
1010
actual fun platformModule() = module {
11-
single<ObservableSettings> { AppleSettings(NSUserDefaults.standardUserDefaults) }
11+
single<ObservableSettings> { NSUserDefaultsSettings(NSUserDefaults.standardUserDefaults) }
12+
single { createDb() }
13+
}
14+
15+
16+
fun createDb(): MyDatabase {
17+
val driver = NativeSqliteDriver(MyDatabase.Schema, "galwaybus.db")
18+
return MyDatabase(driver)
1219
}

android-app/build.gradle.kts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import java.util.*
44

55
plugins {
66
alias(libs.plugins.android.application)
7-
kotlin("android")
87
alias(libs.plugins.googleServices)
98
alias(libs.plugins.compose.compiler)
109
}
@@ -77,13 +76,14 @@ android {
7776

7877
buildFeatures {
7978
compose = true
79+
resValues = true
8080
}
8181

8282
buildTypes {
8383
getByName("release") {
8484
isShrinkResources = true
8585
isMinifyEnabled = true
86-
proguardFiles(getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro")
86+
proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro")
8787
signingConfig = signingConfigs.getByName("release")
8888
}
8989
}

build.gradle.kts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
plugins {
22
alias(libs.plugins.android.application) apply false
3+
alias(libs.plugins.android.kotlin.multiplatform.library) apply false
34
alias(libs.plugins.ksp) apply false
45
alias(libs.plugins.kotlinMultiplatform) apply false
56
alias(libs.plugins.kotlinx.serialization) apply false

gradle/libs.versions.toml

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
[versions]
2-
kotlin = "2.2.0"
3-
ksp = "2.2.0-2.0.2"
4-
kotlinx-coroutines = "1.10.2"
5-
kotlinx-serialization = "1.9.0"
2+
kotlin = "2.4.10"
3+
ksp = "2.3.10"
4+
kotlinx-coroutines = "1.11.0"
5+
kotlinx-serialization = "1.11.0"
66
kotlinx-dateTime = "0.7.1"
77

88

9-
androidGradlePlugin = "8.12.0"
10-
koin = "4.1.0"
11-
ktor = "3.2.3"
9+
androidGradlePlugin = "9.1.1"
10+
koin = "4.2.2"
11+
ktor = "3.5.1"
1212
slf4j = "2.0.17"
1313
sqlDelight = "2.1.0"
14-
kmpNativeCoroutines = "1.0.0-ALPHA-45"
14+
kmpNativeCoroutines = "1.0.5"
1515
googleServices = "4.4.3"
1616

1717
androidxActivity = "1.10.1"
@@ -157,6 +157,7 @@ ktor-common = ["ktor-client-core", "ktor-client-json", "ktor-client-logging", "k
157157

158158
[plugins]
159159
android-application = { id = "com.android.application", version.ref = "androidGradlePlugin" }
160+
android-kotlin-multiplatform-library = { id = "com.android.kotlin.multiplatform.library", version.ref = "androidGradlePlugin" }
160161
ksp = { id = "com.google.devtools.ksp", version.ref = "ksp" }
161162
kotlinMultiplatform = { id = "org.jetbrains.kotlin.multiplatform", version.ref = "kotlin" }
162163
kotlinx-serialization = { id = "org.jetbrains.kotlin.plugin.serialization", version.ref = "kotlin" }
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#Sun May 28 21:12:18 IST 2023
22
distributionBase=GRADLE_USER_HOME
33
distributionPath=wrapper/dists
4-
distributionUrl=https\://services.gradle.org/distributions/gradle-9.0.0-bin.zip
4+
distributionUrl=https\://services.gradle.org/distributions/gradle-9.5.0-bin.zip
55
zipStoreBase=GRADLE_USER_HOME
66
zipStorePath=wrapper/dists

0 commit comments

Comments
 (0)