Cannot Use Kotlin 2.0 Features After Upgrade
I upgraded my Android project to Kotlin 2.0, but I still can't use Kotlin 2.0 features. I believe I have done the integration correctly, yet I keep encountering this issue:
libs.toml
[plugins]
kotlin-compose-compiler = { id = "org.jetbrains.kotlin.plugin.compose", version = "2.0.0"}
app.gradle
plugins {
alias(libs.plugins.kotlin.compose.compiler) apply false
}
build.gradle
plugins {
alias(libs.plugins.kotlin.compose.compiler)
}
gradle.properties
kapt.use.k2=true
ksp.useK2=true
I also removed composeOptions
from the build.gradle
file. However, IDE still warns me. Pls check this photo below.
I'm attaching the code here for you to copy
interface Status {
fun signal() {}
}
interface Ok : Status
interface Postponed : Status
interface Declined : Status
fun signalCheck(signalStatus: Any) {
if (signalStatus is Postponed || signalStatus is Declined) {
signalStatus.signal()
}
}
Source: View source