Arkadii Ivanov
08/10/2023, 11:55 PMandroid {
withGroovyBuilder {
"kotlinOptions" {
setProperty("jvmTarget", "1.8")
}
}
}
It throws "Could not find method kotlinOptions() for arguments ...". Looking at the "What's new" of the 1.9.0 release (link), it mentions the following:
kotlin {
compilerOptions {
jvmTarget.set(...)
}
}
But that doesn't work either: "Unresolved reference: compilerOptions".
How can I set jvmTarget
now?mbonnin
08/10/2023, 11:59 PMtasks.withType(KotlinCompile::class.java).configureEach {
kotlinOptions {
jvmTarget.set(...)
}
}
mbonnin
08/11/2023, 12:01 AMtasks.withType(KotlinCompile::class.java).configureEach {
kotlinOptions {
(this as? KotlinJvmOptions)?.let {
it.jvmTarget = "1.8"
}
}
}
Arkadii Ivanov
08/11/2023, 12:13 AMtasks.withType<KotlinCompile> {
kotlinOptions {
jvmTarget = "1.8"
}
}
Wondering, why the guide says something that is not working?tapchicoma
08/11/2023, 8:17 AMkotlinOptions
are added into android extension was not changed in 1.9.0 - it is added via ExtensionAware
here. And kotlin.compilerOptions {}
DSL should also be available. Please check that you are using 1.9.0 Kotlin Gradle Plugin version and not some older oneArkadii Ivanov
08/11/2023, 8:22 AMArkadii Ivanov
08/11/2023, 8:32 AMtasks.withType
instead, but still maybe it rings the bell?
internal fun Project.setupAndroidCommon() {
extensions.configure<BaseExtension> {
withGroovyBuilder {
"kotlinOptions" {
setProperty("jvmTarget", "1.8")
}
}
}
}
tapchicoma
08/11/2023, 8:40 AMKotlinJvmOptions
itself + how it is added into Android extension 🤔tapchicoma
08/11/2023, 8:40 AMArkadii Ivanov
08/11/2023, 9:07 AM