docs: update some functions

This commit is contained in:
2023-09-22 21:59:20 +08:00
parent 98b1c0556e
commit 7a62fc2894
11 changed files with 256 additions and 47 deletions

View File

@@ -16,51 +16,127 @@
- Gradle 7.0 and above
- JVM 11 and above
- Java 11 and above
## Project Requirements
The project needs to be created using `Android Studio` or `IntelliJ IDEA` and the type is an Android project and the `Kotlin` environment dependency has been integrated.
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.
## Integration Dependencies
**(Optional)** Add dependencies to your project `build.gradle`.
We recommend using Kotlin DSL as the Gradle build script language and [SweetDependency](https://github.com/HighCapable/SweetDependency) to manage dependencies.
#### SweetDependency Method
Add the repositories and dependencies in your project's `SweetDependency` configuration file.
> The following example
```yaml
repositories:
# MavenCentral has a 2-hour cache,
# if the latest version cannot be integrated, please add this
sonatype-oss-releases:
libraries:
com.highcapable.yukireflection:
api:
version: +
...
```
After adding it, run Gradle Sync and all dependencies will be autowired.
Next, deploy dependencies in your project `build.gradle.kts`.
> The following example
```kotlin
dependencies {
implementation(com.highcapable.yukireflection.api)
// ...
}
```
#### Traditional Method (Not Recommended)
Add repositories in your project `build.gradle.kts` or `build.gradle`.
> Kotlin DSL
```kotlin
repositories {
google()
mavenCentral()
// MavenCentral has a 2-hour cache, if the latest version cannot be integrated, please add this URL
maven { url("https://s01.oss.sonatype.org/content/repositories/releases/") }
}
```
> Groovy DSL
```groovy
repositories {
google()
mavenCentral()
// MavenCentral has a 2-hour cache, if you cannot integrate the latest version, please add this address
maven { url "https://s01.oss.sonatype.org/content/repositories/releases" }
// MavenCentral has a 2-hour cache, if the latest version cannot be integrated, please add this URL
maven { url 'https://s01.oss.sonatype.org/content/repositories/releases/' }
}
```
Add dependencies to your app `build.gradle`.
Add dependencies in your project `build.gradle.kts` or `build.gradle`.
> The following example
> Kotlin DSL
```kotlin
dependencies {
implementation("com.highcapable.yukireflection:api:<yuki-version>")
// ...
}
```
> Groovy DSL
```groovy
dependencies {
// Base dependencies
implementation 'com.highcapable.yukireflection:api:<yuki-version>'
// ...
}
```
Please change **&lt;yuki-version&gt;** to the latest version from [here](../about/changelog).
Please change **&lt;yuki-version&gt;** to the latest version [here](../about/changelog).
::: danger
If your project is currently using [YukiHookAPI](https://github.com/fankes/YukiHookAPI), please do not repeatedly integrate **YukiReflection**, because **YukiHookAPI** already contains the functions and exists for related functional changes and repeated integration will cause functional conflicts and cause exceptions.
If your project is currently using the 1.x.x version of [YukiHookAPI](https://github.com/fankes/YukiHookAPI), please do not integrate **YukiReflection** repeatedly, because **YukiHookAPI** already includes it functions and there are changes to related functions.
At this time, you should go to the [documentation](https://fankes.github.io/YukiHookAPI/en/) of **YukiHookAPI** to view the corresponding tutorial.
Repeated integration will cause functional conflicts and cause exceptions.
In this case, you should go to the [Documentation](https://fankes.github.io/YukiHookAPI/zh-cn/) of **YukiHookAPI** view the corresponding usage tutorial.
**YukiHookAPI** will be completely separated from **YukiReflection** in version 2.x.x, by which time you can use it with **YukiHookAPI** at the same time.
:::
Modify the `Kotlin` Jvm version to 11 and above in your app `build.gradle`.
#### Configure Java Version
> The following example
Modify the Java version of Kotlin in your project `build.gradle.kts` or `build.gradle` to 11 or above.
> Kotlin DSL
```kt
android {
compileOptions {
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
}
kotlinOptions {
jvmTarget = "11"
}
}
```
> Groovy DSL
```groovy
android {