JetBrains / compose-multiplatform

Compose Multiplatform, a modern UI framework for Kotlin that makes building performant and beautiful user interfaces easy and enjoyable.
https://jetbrains.com/lp/compose-multiplatform
Apache License 2.0
15.24k stars 1.11k forks source link

Cannot change attributes of configuration ':composeApp:debugFrameworkIosX64' after it has been locked for mutation #4867

Closed luludevmuniz closed 1 month ago

luludevmuniz commented 1 month ago

Describe the bug I'm trying to add ksp and room in my CMP project, but I always get the error from title when trying to add "dependencies { ... }" in build.gradle.kts

Affected platforms

Versions

To Reproduce Steps to reproduce the behavior:

  1. Add room and ksp configuration in libs.version.toml:
    
    [versions]
    ...
    room = "2.7.0-alpha02"
    ksp = "2.0.0-1.0.21"

[libraries] ... room-compiler = { group = "androidx.room", name = "room-compiler", version.ref = "room"} room-runtimme = { group = "androidx.room", name = "room-runtime", version.ref = "room"}

[plugins] ... ksp = { id = "com.google.devtools.ksp", version.ref = "ksp" } room = { id = "androidx.room", version.ref = "room" }

2. Add room and ksp in build.gradle.kts

plugins { ... alias(libs.plugins.ksp) alias(libs.plugins.room) }

kotlin { ... sourceSets { ... commonMain.dependencies { ... implementation(libs.room.runtime) } } }

3. add room schema directory in build.gradle.kts

room { schemaDirectory("$projectDir/schemas") }

4. add the dependencies block with ksp reference
dependencies {
    add("kspAndroid", libs.room.compiler)
    add("kspIosSimulatorArm64", libs.room.compiler)
    add("kspIosX64", libs.room.compiler)
    add("kspIosArm64", libs.room.compiler)
}


**Expected behavior**
Sync gradle without failure

**Additional context**
I could not find a proper setup tutorial for CMP, so I took [Google's Frutties KMP Sample](https://github.com/android/kotlin-multiplatform-samples/tree/main/Fruitties) as reference, so I guess it's just a miss configuration from my part.
I have tried to place the "dependencies" block outside and inside "kotlin" block in build.gradle.kts, but it didn't work.
luludevmuniz commented 1 month ago

Fixed by adding ksp.useKSP2=true in gradle.properties.