Vishal kumar singhvi
05/07/2026, 9:01 AMgradle.properties
# Kotlin
kotlin.code.style=official
kotlin.daemon.jvmargs=-Xmx6144M -XX:MaxMetaspaceSize=512m -XX:+UseG1GC
# Kotlin/Native compiler runs its own JVM process — separate from the Kotlin daemon
kotlin.native.jvmArgs=-Xmx12288M -XX:MaxMetaspaceSize=1g -XX:+UseG1GC
# Gradle
org.gradle.jvmargs=-Xmx8g -XX:MaxMetaspaceSize=1g
org.gradle.configuration-cache=true
org.gradle.caching=true
# Android
android.nonTransitiveRClass=true
android.useAndroidX=true
build.gradle.kts
listOf(
iosArm64(),
iosSimulatorArm64()
).forEach { iosTarget ->
iosTarget.binaries.framework {
baseName = "ComposeApp"
isStatic = true
// Disable the DevirtualizationAnalysis phase which OOMs on large projects.
// This skips an interprocedural optimization pass — the binary is slightly
// larger but functionally identical. Dead code elimination still runs.
freeCompilerArgs += listOf(
"-Xdisable-phases=DevirtualizationAnalysis",
"-Xadd-light-debug=disable",
)
}
}
If anyone has optimized the KMP iOS release build time, please share the best approach or configuration.Chrimaeon
05/07/2026, 9:32 AMVishal kumar singhvi
05/07/2026, 9:33 AMArtem Olkov
05/07/2026, 12:34 PMVishal kumar singhvi
05/08/2026, 12:57 PMVishal kumar singhvi
05/08/2026, 12:58 PMlistOf(
iosArm64(),
iosSimulatorArm64()
).forEach { iosTarget ->
iosTarget.binaries.framework {
baseName = "ComposeApp"
isStatic = true
// KDoc export (on by default since 2.2.20) bloats ObjC header generation for no benefit
// in an app framework — Xcode autocomplete never reads it meaningfully.
@OptIn(ExperimentalKotlinGradlePluginApi::class)
exportKdoc.set(false)
// DevirtualizationAnalysis OOMs on large projects; skipping is safe — DCE still runs.
// EscapeAnalysis is an expensive stack-allocation pass; its gain rarely justifies the
// compile time cost on a large app codebase.
// light-debug=disable skips generation of debug metadata in release binaries.
freeCompilerArgs += listOf(
"-Xdisable-phases=DevirtualizationAnalysis",
"-Xdisable-phases=EscapeAnalysis",
"-Xadd-light-debug=disable",
)
}
}
andVishal kumar singhvi
05/08/2026, 12:58 PM#Kotlin
kotlin.code.style=official
kotlin.daemon.jvmargs=-Xmx6144M -XX:MaxMetaspaceSize=512m -XX:+UseG1GC
# Kotlin/Native compiler runs its own JVM process â separate from the Kotlin daemon
kotlin.native.jvmArgs=-Xmx12288M -XX:MaxMetaspaceSize=1g -XX:+UseG1GC
# Incremental K/N klib compilation â avoids recompiling unchanged source sets between builds
kotlin.incremental.native=true
# Switch LLVM from -O2 to -Oz for release binaries: smaller binary AND faster LLVM phase
# (Experimental in Kotlin 2.2.20+; primary driver of 30-40 min release build times)
kotlin.native.binary.smallBinary=true
#Gradle
org.gradle.jvmargs=-Xmx8g -XX:MaxMetaspaceSize=1g
org.gradle.configuration-cache=true
org.gradle.caching=true
# Allow independent tasks (e.g. kspIosArm64, kspIosSimulatorArm64) to run concurrently
org.gradle.parallel=true
#Android
android.nonTransitiveRClass=true
android.useAndroidX=trueVishal kumar singhvi
05/12/2026, 2:34 PMVishal kumar singhvi
05/12/2026, 2:34 PM