Как исправить эту ошибку компиляции?

Execution failed for task ':app:kspDebugKotlin'.
> 'compileDebugJavaWithJavac' task (current target is 1.8) and 'kspDebugKotlin' task (current target is 17) jvm target compatibility should be set to the same Java version.
  Consider using JVM toolchain: https://kotl.in/gradle/jvm/toolchain

Ответы (2 шт):

Автор решения: woesss

У AGP и котлин установлены разные версии java по-умолчанию.
Вам нужно настроить их на одну версию:

android {

    compileOptions {
        sourceCompatibility = JavaVersion.VERSION_1_8
        targetCompatibility = JavaVersion.VERSION_1_8
    }
    kotlinOptions {
        jvmTarget = "1.8"
    }
}
→ Ссылка
Автор решения: Bulat Bikmetov

Понизил версии и все заработало:

plugins {
   id("com.google.devtools.ksp") version "1.8.0-1.0.8" apply false
}

implementation("androidx.room:room-runtime:2.4.3")
annotationProcessor("androidx.room:room-compiler:2.4.3")
ksp("androidx.room:room-compiler:2.4.3")
→ Ссылка