Mohammed Alramlawi
06/24/2024, 12:25 PMKMM
project. While building a native Android project typically takes 10-30 seconds
, building the KMM project can take up to 10 minutes
. I'm looking for ways to speed up this process.
Here are the details of my current setup:
• Gradle version: 8.7
• agp : 8.2.2
• Kotlin version: 2.0.0
• JavaVersion.VERSION_11
I've already tried the following optimizations:
• Enabled the Gradle Daemon.
• Enabled parallel project execution.
• Configured incremental compilation for Kotlin.
• Using Gradle build cache.
Does anyone have any additional suggestions or best practices for reducing build times in KMM projects? Any configurations, tools, or techniques that have worked for you would be greatly appreciated!
Thank you!Bruno Medeiros
06/24/2024, 12:39 PMephemient
06/24/2024, 12:42 PMephemient
06/24/2024, 12:44 PMMohammed Alramlawi
06/24/2024, 12:49 PMkotlin {
androidTarget {
@OptIn(ExperimentalKotlinGradlePluginApi::class)
compilerOptions {
jvmTarget.set(JvmTarget.JVM_11)
}
}
listOf(
iosX64(),
iosArm64(),
iosSimulatorArm64()
).forEach { iosTarget ->
iosTarget.binaries.framework {
baseName = "ComposeApp"
isStatic = true
}
}
sourceSets {
androidMain.dependencies {
implementation(libs.androidx.compose.ui.tooling.preview)
implementation(libs.androidx.activity.compose)
implementation(libs.ktor.client.okhttp)
}
iosMain.dependencies {
implementation(libs.ktor.client.darwin)
}
commonMain.dependencies {
implementation(compose.runtime)
implementation(compose.foundation)
implementation(compose.material)
implementation(compose.ui)
implementation(compose.components.resources)
implementation(compose.components.uiToolingPreview)
implementation(libs.ktor.client.core)
implementation(libs.ktor.client.content.negotiation)
implementation(libs.ktor.serialization.kotlinx.json)
implementation(libs.kamel)
implementation(libs.koin.core)
implementation(libs.voyager.navigator)
implementation(libs.voyager.koin)
}
}
}
ephemient
06/24/2024, 12:50 PMMohammed Alramlawi
06/24/2024, 1:17 PMLuca
06/28/2024, 9:35 PMLuca
06/28/2024, 9:36 PMkotlin.incremental.native=true
Would probably help a bunch for native builds after the first buildMohammed Alramlawi
06/29/2024, 1:19 AMLuca
06/29/2024, 5:32 AM