I have been struggling to add Room dependencies for a couple of days now(not proud). There is always an error no matter what i try. I am not the most experienced though.
I added the below from the Android docs site.
`val room_version = "2.5.2"
implementation("androidx.room:room-runtime:$room_version")
annotationProcessor("androidx.room:room-compiler:$room_version")
//1
// To use Kotlin annotation processing tool (kapt)
kapt("androidx.room:room-compiler:$room_version")
//2
// To use Kotlin Symbol Processing (KSP) (2)
ksp("androidx.room:room-compiler:$room_version")
// optional - Kotlin Extensions and Coroutines support for Room
implementation("androidx.room:room-ktx:$room_version")`
All depencdencies can resolve except what is marked 1 & 2.
For 1, i get
Type mismatch. Required: KaptOptions Found: String
For 2, i get
Unresolved reference: ksp
I added these to my plugins from searches i did but to no avail. ` id("com.google.devtools.ksp") version "1.8.21-1.0.11" kotlin("android")
// Apply the Room and Kotlin Kapt plugins
kotlin("kotlin-kapt")
id("androidx.room.room-compiler")`
What properly worked was following the migration guide at Migrate from kapt to KSP
I used
ksp("androidx.room:room-compiler:$room_version")
Added the below to the project level build.grradle
plugins {
id("com.google.devtools.ksp") version "1.8.10-1.0.9" apply false}
Added the below to the module level build.gradle
plugins {
id("com.google.devtools.ksp")}
And remove everything added for the kapt