docs: update Java requirement description

This commit is contained in:
2023-10-05 02:26:55 +08:00
parent bd68a85171
commit 7a49112446
2 changed files with 32 additions and 16 deletions

View File

@@ -18,6 +18,8 @@
- Java 11 and above
- Java 17 and above (Since API `1.0.3`)
## Project Requirements
The project needs to be created using `Android Studio` or `IntelliJ IDEA` and the type is an Java or Android project and the Kotlin environment dependency has been integrated.
@@ -120,18 +122,18 @@ In this case, you should go to the [Documentation](https://fankes.github.io/Yuki
#### Configure Java Version
Modify the Java version of Kotlin in your project `build.gradle.kts` or `build.gradle` to 11 or above.
Modify the Java version of Kotlin in your project `build.gradle.kts` or `build.gradle` to 17 or above.
> Kotlin DSL
```kt
android {
compileOptions {
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}
kotlinOptions {
jvmTarget = "11"
jvmTarget = "17"
}
}
```
@@ -141,11 +143,17 @@ android {
```groovy
android {
compileOptions {
sourceCompatibility JavaVersion.VERSION_11
targetCompatibility JavaVersion.VERSION_11
sourceCompatibility JavaVersion.VERSION_17
targetCompatibility JavaVersion.VERSION_17
}
kotlinOptions {
jvmTarget = '11'
jvmTarget = '17'
}
}
```
```
::: warning
Since API **1.0.3**, the Java version used by Kotlin defaults to 17, and versions 11 and below are no longer supported.
:::

View File

@@ -18,6 +18,8 @@
- Java 11 及以上
- Java 17 及以上 (Since API `1.0.3`)
## 项目要求
项目需要使用 `Android Studio``IntelliJ IDEA` 创建且类型为 Java 或 Android 项目并已集成 Kotlin 环境依赖。
@@ -115,18 +117,18 @@ dependencies {
#### 配置 Java 版本
在你的项目 `build.gradle.kts``build.gradle` 中修改 Kotlin 的 Java 版本为 11 及以上。
在你的项目 `build.gradle.kts``build.gradle` 中修改 Kotlin 的 Java 版本为 17 及以上。
> Kotlin DSL
```kt
android {
compileOptions {
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}
kotlinOptions {
jvmTarget = "11"
jvmTarget = "17"
}
}
```
@@ -136,11 +138,17 @@ android {
```groovy
android {
compileOptions {
sourceCompatibility JavaVersion.VERSION_11
targetCompatibility JavaVersion.VERSION_11
sourceCompatibility JavaVersion.VERSION_17
targetCompatibility JavaVersion.VERSION_17
}
kotlinOptions {
jvmTarget = '11'
jvmTarget = '17'
}
}
```
```
::: warning
自 API **1.0.3** 版本后 Kotlin 使用的 Java 版本默认为 17不再支持 11 及以下版本。
:::