Status Update
Comments
pa...@outlook.com <pa...@outlook.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:
da...@google.com <da...@google.com>
pa...@outlook.com <pa...@outlook.com> #3
Will try to use the example provided by you to check if it fixes the issue.
pa...@outlook.com <pa...@outlook.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")
}
pa...@outlook.com <pa...@outlook.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"
da...@google.com <da...@google.com> #6
Great detective work! You are totally right in that we have a 'key' bug. Specifically we are incorrectly keeping track of 'added columns without complex changes' using the column name, but forgot to also include the table as part of the key.
See:
I'll fix this soon.
ap...@google.com <ap...@google.com> #7
Branch: androidx-main
commit bfa17ff8b0cff84789e11a7efb384ab08c4f91e6
Author: Daniel Santiago Rivera <danysantiago@google.com>
Date: Thu Sep 23 12:10:59 2021
Don't key auto-migration added columns by name.
This is not needed and causes issues when two columns of the same name are added to two to dofferent tables.
Bug: 200818663
Test: SchemaDifferTest.kt
Relnote: Fixed an issue with auto-migrations not adding new columns when another table in the same auto-migration also had a new column with the same name.
Change-Id: Ia5db52982e050714f224805d9949215b6caeff56
M room/room-compiler/src/main/kotlin/androidx/room/util/SchemaDiffer.kt
M room/room-compiler/src/main/kotlin/androidx/room/writer/AutoMigrationWriter.kt
M room/room-compiler/src/test/kotlin/androidx/room/util/SchemaDifferTest.kt
M room/room-compiler/src/test/kotlin/androidx/room/writer/AutoMigrationWriterTest.kt
da...@google.com <da...@google.com> #8
This is fixed, but sadly didn't make it into 2.4.0-alpha05, it'll be in the next release.
da...@loylap.com <da...@loylap.com> #9
I have a similar
da...@loylap.com <da...@loylap.com> #10
sorry I've commented on the wrong issue and it won't let me delete, please ignore!
Description
Component used: Room Version used: 2.4.0-alpha04 Devices/Android versions reproduced on: Android Pixel 4A
I have an entity where I only added a new column "newColumn" between database version 1 to database version 2
I have configured the database as such
And when I run the app after the new schema files have already been generated, the app crashes and this is the error snippet that shows in the console (formatted for easier reading)
When I attach a debug point to TableInfo it stops at
because the table count is different, which makes sense to be different since I have added a new column to the existing table, but for some reason the migration logic is not account for that even though it is very suggested that auto migrations should work straight away when we just add a new column to an existing table:https://developer.android.com/training/data-storage/room/migrating-db-versions
And the blog as well also discusses straight automigration logic for just adding a new column to exiting tables:https://medium.com/androiddevelopers/room-auto-migrations-d5370b0ca6eb
What am I doing wrong here, or is this a bug? I cannot find anything in the documentation to solve this for myself.