Status Update
Comments
da...@google.com <da...@google.com> #2
For Kotlin 2.0 and KSP 2.0 the Cannot change attributes of configuration ':composeApp:debugFrameworkIosX64' after it has been locked for mutation
really seems like a KSP issue. You should file a bug in their repository with a sample app if possible.
If you downgrade to Kotlin 1.9 then things 'should' work, there are example apps out there with such configuration, like the following one:
ku...@gmail.com <ku...@gmail.com> #3
Will try to use the example provided by you to check if it fixes the issue.
da...@google.com <da...@google.com>
da...@google.com <da...@google.com> #4
Note that this issue happens when applying the Compose, KSP and Room Plugin together in Kotlin 2.0.x, the workaround for now is to not use the Room Gradle Plugin and instead specify the schema location vis KSP arguments:
// In the build.gradle
ksp {
arg("room.schemaLocation", "${projectDir}/schemas")
}
an...@gmail.com <an...@gmail.com> #5
Hi, I encountered a similar problem and was able to resolve it by updating the dependencies
room = "2.7.0-alpha08"
ksp = "2.0.20-1.0.25"
compose-plugin = "1.6.11"
kotlin = "2.0.20"
Description
Version used: 2.7.0-alpha03
Devices/Android versions reproduced on:
Android Studio Sync Failing
On using room 2.7.0 alpha versions in a compose multiplatform project generated from official jetbrains wizard
Cannot change attributes of configuration ':composeApp:debugFrameworkIosX64' after it has been locked for mutation
On debugging I found that these lines of code in build.gradle.kts kotlin block meant for compilation on ios are causing this issue:
kotlin{
listOf(
iosX64(),
iosArm64(),
iosSimulatorArm64()
).forEach { iosTarget ->
iosTarget.binaries.framework {
baseName = "ComposeApp"
isStatic = true
}
}
}
On commenting the above lines, android builds successfully and room works fine while ios is unable to build due to the same error.
Here is an extract from my libs.versions.toml file
[versions]
agp = "8.3.0"
android-compileSdk = "34"
android-minSdk = "24"
android-targetSdk = "34"
androidx-activityCompose = "1.9.0"
compose-plugin = "1.6.10"
kotlin = "2.0.0"
room = "2.7.0-alpha03"
ksp = "2.0.0-1.0.21"
sqlite = "2.5.0-SNAPSHOT"
[libraries]
androidx-activity-compose = { module = "androidx.activity:activity-compose", version.ref = "androidx-activityCompose" }
room-runtime = { module = "androidx.room:room-runtime", version.ref = "room" }
room-compiler = { module = "androidx.room:room-compiler", version.ref = "room" }
sqlite-bundled = { module = "androidx.sqlite:sqlite-bundled", version.ref = "sqlite" }
[plugins]
androidApplication = { id = "com.android.application", version.ref = "agp" }
androidLibrary = { id = "com.android.library", version.ref = "agp" }
jetbrainsCompose = { id = "org.jetbrains.compose", version.ref = "compose-plugin" }
compose-compiler = { id = "org.jetbrains.kotlin.plugin.compose", version.ref = "kotlin" }
kotlinMultiplatform = { id = "org.jetbrains.kotlin.multiplatform", version.ref = "kotlin" }
ksp = { id = "com.google.devtools.ksp", version.ref = "ksp" }
room = { id = "androidx.room", version.ref = "room" }
Android Studio version details:
Android Studio Jellyfish | 2023.3.1 Patch 1
Build #AI-233.14808.21.2331.11842104, built on May 15, 2024
Runtime version: 17.0.10+0--11572160 amd64
1) I have tried removing and readding all dependencies but only after adding room is this issue reproduced.
2) On downgrading to kotlin 1.9.23 and compose plugin to 1.6.2, the sync issue goes away but the build fails due to an unknown error which is not provided in the logs by android studio so there is some sort of incompatibility still at place here.
3) Alpha03 released today does not fix this issue.