Closed sam43 closed 4 months ago
Can you try to add --stacktrace
to your Gradle command line?
I'm seeing something similar. Not sure if it's the same thing that @sam43 is seeing. but I'll describe more my situation. I'm trying to use Room in a multiplatform module. I defined a function in the common sources:
expect inline fun <reified T : RoomDatabase> getDatabaseBuilder(): RoomDatabase.Builder<T>
with the actuals as well and this seems to cause my error. I think the following, taken from the Room docs, also was giving me some issues:
fun getRoomDatabase(
builder: RoomDatabase.Builder<AppDatabase>
): AppDatabase {
return builder
.addMigrations(MIGRATIONS)
.fallbackToDestructiveMigrationOnDowngrade()
.setDriver(BundledSQLiteDriver())
.setQueryCoroutineContext(Dispatchers.IO)
.build()
}
I have updated my code to look more like what John O'Reilly did in his FantasyPremierLeague app, and I seem to have gotten past the exception.
I've tried using ksp 2.0.0-1.0.21
as well.
here is my stacktrace:
Can you try to add
--stacktrace
to your Gradle command line?
Hi, thank you for your responses. I forgot to add the --stacktrace
with the description. I can still share it reproducing the issue again, as I have already resolved it with 2 simple steps. The --stacktrace
said it was an room
dependency issue and the stable version was not compatible with the KSP2. cc: @ting-yuan
Yes, @fluxxion82 's solution might workout but I would like to share my approach to fix it with the mentioned environment (dependecies). And yes I have tried using 2.0.0-1.0.21
as well but no luck!
I updated ksp beta support from ksp.useKSP2=true
to ksp.useKSP2=false
(as it was the solution before when it was in beta so I made it false
) and used room dependency version from stable to androidxRoom = "2.7.0-alpha04"
. And that's all to resolve my issue.
Note: Same kinda issue can be faced while using hilt = "2.50"
or so in that case please update it to 2.51.1
.
kotlin = "2.0.20-RC"
room = "2.7.0-alpha01"
ksp = "2.0.20-RC-1.0.24"
and add ksp.useKSP2=true
to your gradle.properties
(if you are using kotlin 2.x.x
)
this will fix your problem and if you still getting the same error then try to remove @TypeConverters(<converter class name>::class)
I was migrating from groovy to dsl (
build.gradle
tobuild.gradle.kts
) with KSP2kotlin = "2.0.0"
kotlin-ksp = "2.0.0-1.0.22"
Already enabled beta:
ksp.useKSP2=true
Still getting following error message and couldn't get the problem. I saw similar issue was created but no satisfactory answer.
If anyone has any suggestion for me, how to get rid of or fix it?
Relevant issues: #1929 #1941 etc.