https://kotlinlang.org logo
#getting-started
Title
# getting-started
l

Laurent Laborde

02/01/2023, 6:22 AM
on kotlin 1.8.0, in a project with mixed kotlin and java code (converting java project to kotlin), any idea why i have this error : Unrecognized option: -Xuse-k2
s

Stephan Schröder

02/03/2023, 10:07 AM
maybe you use the wrong KotlinCompile? This works for me in my build.gradle.kts:
Copy code
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile> {
    kotlinOptions.useK2 = true
}
there is another
KotlinCompile
class in package
org.jetbrains.kotlin.gradle.dsl
, but that one doesn't work.
3 Views