File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -39,14 +39,17 @@ Modify the Java version of Kotlin in your project's `build.gradle.kts` to 17 or
3939
4040> Kotlin DSL
4141
42- ``` kt
42+ ``` kotlin
4343android {
4444 compileOptions {
4545 sourceCompatibility = JavaVersion .VERSION_17
4646 targetCompatibility = JavaVersion .VERSION_17
4747 }
48- kotlinOptions {
49- jvmTarget = " 17"
48+ }
49+
50+ tasks.withType<KotlinJvmCompile >().configureEach {
51+ compilerOptions {
52+ jvmTarget.set(JvmTarget .JVM_17 )
5053 }
5154}
5255```
Original file line number Diff line number Diff line change @@ -36,14 +36,17 @@ repositories {
3636
3737在你的项目 ` build.gradle.kts ` 中修改 Kotlin 的 Java 版本为 17 及以上。
3838
39- ``` kt
39+ ``` kotlin
4040android {
4141 compileOptions {
4242 sourceCompatibility = JavaVersion .VERSION_17
4343 targetCompatibility = JavaVersion .VERSION_17
4444 }
45- kotlinOptions {
46- jvmTarget = " 17"
45+ }
46+
47+ tasks.withType<KotlinJvmCompile >().configureEach {
48+ compilerOptions {
49+ jvmTarget.set(JvmTarget .JVM_17 )
4750 }
4851}
4952```
You can’t perform that action at this time.
0 commit comments