mirror of
https://github.com/HighCapable/YukiHookAPI.git
synced 2025-09-04 01:35:17 +08:00
docs: update some functions
This commit is contained in:
@@ -20,4 +20,4 @@ You can use the **Chrome Translation Plugin** to translate entire pages for refe
|
||||
|
||||
> 这是一个预置反射类型的常量类,主要为 `Android` 相关组件的 `Class` 内容,跟随版本更新会逐一进行增加。
|
||||
|
||||
详情可 [点击这里](https://github.com/fankes/YukiHookAPI/blob/master/yukihookapi/src/main/java/com/highcapable/yukihookapi/hook/type/android/ComponentTypeFactory.kt) 进行查看。
|
||||
详情可 [点击这里](https://github.com/fankes/YukiHookAPI/blob/master/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/type/android/ComponentTypeFactory.kt) 进行查看。
|
@@ -20,4 +20,4 @@ You can use the **Chrome Translation Plugin** to translate entire pages for refe
|
||||
|
||||
> 这是一个预置反射类型的常量类,主要为 `Android` 相关 `Graphics` 的 `Class` 内容,跟随版本更新会逐一进行增加。
|
||||
|
||||
详情可 [点击这里](https://github.com/fankes/YukiHookAPI/blob/master/yukihookapi/src/main/java/com/highcapable/yukihookapi/hook/type/android/GraphicsTypeFactory.kt) 进行查看。
|
||||
详情可 [点击这里](https://github.com/fankes/YukiHookAPI/blob/master/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/type/android/GraphicsTypeFactory.kt) 进行查看。
|
@@ -20,4 +20,4 @@ You can use the **Chrome Translation Plugin** to translate entire pages for refe
|
||||
|
||||
> 这是一个预置反射类型的常量类,主要为 `Android` 相关 `Widget` 的 `Class` 内容,跟随版本更新会逐一进行增加。
|
||||
|
||||
详情可 [点击这里](https://github.com/fankes/YukiHookAPI/blob/master/yukihookapi/src/main/java/com/highcapable/yukihookapi/hook/type/android/ViewTypeFactory.kt) 进行查看。
|
||||
详情可 [点击这里](https://github.com/fankes/YukiHookAPI/blob/master/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/type/android/ViewTypeFactory.kt) 进行查看。
|
@@ -20,4 +20,4 @@ You can use the **Chrome Translation Plugin** to translate entire pages for refe
|
||||
|
||||
> 这是一个预置反射类型的常量类,主要为 `Java` 相关基本变量类型的 `Class` 内容,跟随版本更新会逐一进行增加。
|
||||
|
||||
详情可 [点击这里](https://github.com/fankes/YukiHookAPI/blob/master/yukihookapi/src/main/java/com/highcapable/yukihookapi/hook/type/java/VariableTypeFactory.kt) 进行查看。
|
||||
详情可 [点击这里](https://github.com/fankes/YukiHookAPI/blob/master/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/type/java/VariableTypeFactory.kt) 进行查看。
|
@@ -4,24 +4,26 @@
|
||||
|
||||
Before using the following functions, in order to prevent Resource Id from conflicting with each other, you need to modify the Resource Id in the `build.gradle` of the current Xposed Module project.
|
||||
|
||||
- Kotlin Gradle DSL
|
||||
> Kotlin DSL
|
||||
|
||||
```kotlin
|
||||
android {
|
||||
androidResources.additionalParameters("--allow-reserved-package-id", "--package-id", "0x64")
|
||||
androidResources.additionalParameters += listOf("--allow-reserved-package-id", "--package-id", "0x64")
|
||||
}
|
||||
```
|
||||
|
||||
- Groovy
|
||||
> Groovy DSL
|
||||
|
||||
```groovy
|
||||
android {
|
||||
aaptOptions.additionalParameters '--allow-reserved-package-id', '--package-id', '0x64'
|
||||
androidResources.additionalParameters += ['--allow-reserved-package-id', '--package-id', '0x64']
|
||||
}
|
||||
```
|
||||
|
||||
::: warning
|
||||
|
||||
**aaptOptions.additionalParameters** in previous versions has been deprecated, please refer to the above writing method and keep your **Android Gradle Plugin** to the latest version.
|
||||
|
||||
The sample Resource Id value provided is for reference only, **0x7f** cannot be used, the default is **0x64**.
|
||||
|
||||
In order to prevent the existence of multiple Xposed Modules in the current Host App, it is recommended to customize your own Resource Id.
|
||||
@@ -296,7 +298,7 @@ This way, we can create dialogs in the Host App very simply using `MaterialAlert
|
||||
|
||||
Because some **androidx** dependent libraries or custom themes used by some apps may interfere with the actual style of the current **MaterialAlertDialog**, such as the button style of the dialog.
|
||||
|
||||
You can refer to the **Module App Demo** in this case and see [here is the sample code](https://github.com/fankes/YukiHookAPI/tree/master/demo-module/src/main/java/com/highcapable/yukihookapi/demo_module/hook/factory/ComponentCompatFactory.kt) to fix this problem.
|
||||
You can refer to the **Module App Demo** in this case and see [here is the sample code](https://github.com/fankes/YukiHookAPI/tree/master/samples/demo-module/src/main/java/com/highcapable/yukihookapi/demo_module/hook/factory/ComponentCompatFactory.kt) to fix this problem.
|
||||
|
||||
**ClassCastException** may occur when some apps are created, please manually specify a new **Configuration** instance to fix.
|
||||
|
||||
|
@@ -60,9 +60,9 @@ resources().hook {
|
||||
|
||||
> You can find the demo provided by the API below to learn how to use `YukiHookAPI`.
|
||||
|
||||
- Host App Demo [click here to view](https://github.com/fankes/YukiHookAPI/tree/master/demo-app)
|
||||
- Host App Demo [click here to view](https://github.com/fankes/YukiHookAPI/tree/master/samples/demo-app)
|
||||
|
||||
- Module App Demo [click here to view](https://github.com/fankes/YukiHookAPI/tree/master/demo-module)
|
||||
- Module App Demo [click here to view](https://github.com/fankes/YukiHookAPI/tree/master/samples/demo-module)
|
||||
|
||||
Install the Host App and Module App Demo at the same time, and test the hooked function in the Host App by activating the Module App.
|
||||
|
||||
|
@@ -22,7 +22,7 @@ Please use `Kotlin`, the framework part of the code composition is also compatib
|
||||
|
||||
All demo code in this document will be described using `Kotlin`, if you don't know how to use `Kotlin` then you may not be able to use `YukiHookAPI`.
|
||||
|
||||
Part of the Java Demo code can be found [here](https://github.com/fankes/YukiHookAPI/tree/master/demo-module/src/main/java/com/highcapable/yukihookapi/demo_module/hook/java), but not recommended.
|
||||
Part of the Java Demo code can be found [here](https://github.com/fankes/YukiHookAPI/tree/master/samples/demo-module/src/main/java/com/highcapable/yukihookapi/demo_module/hook/java), but not recommended.
|
||||
|
||||
## Source of Inspiration
|
||||
|
||||
|
@@ -16,7 +16,7 @@
|
||||
|
||||
- Gradle 7.0 and above
|
||||
|
||||
- JVM 11 and above (Since API `1.0.80`)
|
||||
- Java 11 and above (Since API `1.0.80`)
|
||||
|
||||
## Automatically Build Project
|
||||
|
||||
@@ -34,62 +34,183 @@ Use `Android Studio` or `IntelliJ IDEA` to create a new Android project and sele
|
||||
|
||||
### Integration Dependencies
|
||||
|
||||
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:
|
||||
# ❗Must be added when used as an Xposed Module, otherwise optional
|
||||
rovo89-xposed-api:
|
||||
url: https://api.xposed.info/
|
||||
# MavenCentral has a 2-hour cache,
|
||||
# if the latest version cannot be integrated, please add this
|
||||
sonatype-oss-releases:
|
||||
|
||||
plugins:
|
||||
# ❗Must be added when used as an Xposed Module, otherwise optional
|
||||
com.google.devtools.ksp:
|
||||
version: +
|
||||
...
|
||||
|
||||
libraries:
|
||||
# ❗Must be added when used as an Xposed Module, otherwise optional
|
||||
de.robv.android.xposed:
|
||||
api:
|
||||
version: 82
|
||||
repositories:
|
||||
rovo89-xposed-api
|
||||
com.highcapable.yukihookapi:
|
||||
api:
|
||||
version: +
|
||||
# ❗Must be added when used as an Xposed Module, otherwise optional
|
||||
ksp-xposed:
|
||||
version-ref: <this>::api
|
||||
...
|
||||
```
|
||||
|
||||
After adding it, run Gradle Sync and all dependencies will be autowired.
|
||||
|
||||
Next, deploy plugins in your project `build.gradle.kts`.
|
||||
|
||||
> The following example
|
||||
|
||||
```kotlin
|
||||
plugins {
|
||||
// ❗Must be added when used as an Xposed Module, otherwise optional
|
||||
autowire(libs.plugins.com.google.devtools.ksp)
|
||||
// ...
|
||||
}
|
||||
```
|
||||
|
||||
Then, deploy dependencies in your project `build.gradle.kts`.
|
||||
|
||||
> The following example
|
||||
|
||||
```kotlin
|
||||
dependencies {
|
||||
// Basic dependencies
|
||||
implementation(com.highcapable.yukihookapi.api)
|
||||
// ❗Must be added when used as an Xposed Module, otherwise optional
|
||||
compileOnly(de.robv.android.xposed.api)
|
||||
// ❗Must be added when used as an Xposed Module, otherwise optional
|
||||
ksp(com.highcapable.yukihookapi.ksp.xposed)
|
||||
}
|
||||
```
|
||||
|
||||
#### Traditional Method (Not Recommended)
|
||||
|
||||
Add repositories in your project `build.gradle.kts` or `build.gradle`.
|
||||
|
||||
> Kotlin DSL
|
||||
|
||||
```kotlin
|
||||
repositories {
|
||||
google()
|
||||
mavenCentral()
|
||||
// ❗Must be added when used as an Xposed Module, otherwise optional
|
||||
maven { url("https://api.xposed.info/") }
|
||||
// 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()
|
||||
// ❗If your Plugin version is too low, be sure to add it as an Xposed Module, other cases are optional
|
||||
maven { url "https://dl.bintray.com/kotlin/kotlin-eap" }
|
||||
// ❗Be sure to add it as an Xposed Module, optional in other cases
|
||||
maven { url "https://api.xposed.info/" }
|
||||
// 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" }
|
||||
// ❗Must be added when used as an Xposed Module, otherwise optional
|
||||
maven { url 'https://api.xposed.info/' }
|
||||
// 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 `plugin` to your app `build.gradle`.
|
||||
Add plugins in your project `build.gradle.kts` or `build.gradle`.
|
||||
|
||||
> The following example
|
||||
> Kotlin DSL
|
||||
|
||||
```kotlin
|
||||
plugins {
|
||||
// ❗Must be added when used as an Xposed Module, otherwise optional
|
||||
id("com.google.devtools.ksp") version "<ksp-version>"
|
||||
}
|
||||
```
|
||||
|
||||
> Groovy DSL
|
||||
|
||||
```groovy
|
||||
plugins {
|
||||
// ❗Be sure to add it as an Xposed Module, optional in other cases
|
||||
// ❗Must be added when used as an Xposed Module, otherwise optional
|
||||
id 'com.google.devtools.ksp' version '<ksp-version>'
|
||||
}
|
||||
```
|
||||
|
||||
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 {
|
||||
// Basic dependency
|
||||
implementation("com.highcapable.yukihookapi:api:<yuki-version>")
|
||||
// ❗Must be added when used as an Xposed Module, otherwise optional
|
||||
compileOnly("de.robv.android.xposed:api:82")
|
||||
// ❗Must be added when used as an Xposed Module, otherwise optional
|
||||
ksp("com.highcapable.yukihookapi:ksp-xposed:<yuki-version>")
|
||||
}
|
||||
```
|
||||
|
||||
> Groovy DSL
|
||||
|
||||
```groovy
|
||||
dependencies {
|
||||
// Base dependencies
|
||||
// Basic dependency
|
||||
implementation 'com.highcapable.yukihookapi:api:<yuki-version>'
|
||||
// ❗Be sure to add it as an Xposed Module, optional in other cases
|
||||
// ❗Must be added when used as an Xposed Module, otherwise optional
|
||||
compileOnly 'de.robv.android.xposed:api:82'
|
||||
// ❗Be sure to add it as an Xposed Module, optional in other cases
|
||||
// ❗Must be added when used as an Xposed Module, otherwise optional
|
||||
ksp 'com.highcapable.yukihookapi:ksp-xposed:<yuki-version>'
|
||||
}
|
||||
```
|
||||
|
||||
Please modify **<ksp-version>** to the latest version from [here](https://github.com/google/ksp/releases) **(Please choose your current corresponding Kotlin version)**.
|
||||
Please modify **<ksp-version>** to the latest version found [here](https://github.com/google/ksp/releases) **(please note to select your current corresponding Kotlin version)**.
|
||||
|
||||
Please modify **<yuki-version>** to the latest version [here](../about/changelog).
|
||||
Please change **<yuki-version>** to the latest version [here](../about/changelog).
|
||||
|
||||
::: danger
|
||||
:::danger
|
||||
|
||||
The **api** of **YukiHookAPI** and the versions that **ksp-xposed** depend on must correspond one by one, otherwise a version mismatch error will occur.
|
||||
The **api** and **ksp-xposed** dependency versions of **YukiHookAPI** must correspond one-to-one, otherwise a version mismatch error will occur.
|
||||
|
||||
We recommend using [SweetDependency](https://github.com/HighCapable/SweetDependency) to autowire dependencies for you.
|
||||
|
||||
:::
|
||||
|
||||
Modify the JVM version of `Kotlin` 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 {
|
||||
@@ -105,7 +226,7 @@ android {
|
||||
|
||||
::: warning
|
||||
|
||||
Since API **1.0.80** version, the default JVM version is 11, and 1.8 and below are no longer supported.
|
||||
Since API **1.0.80**, the Java version used by Kotlin defaults to 11, and versions 1.8 and below are no longer supported.
|
||||
|
||||
:::
|
||||
|
||||
|
@@ -12,4 +12,4 @@ pageClass: code-page
|
||||
|
||||
> 这是一个预置反射类型的常量类,主要为 `Android` 相关组件的 `Class` 内容,跟随版本更新会逐一进行增加。
|
||||
|
||||
详情可 [点击这里](https://github.com/fankes/YukiHookAPI/blob/master/yukihookapi/src/main/java/com/highcapable/yukihookapi/hook/type/android/ComponentTypeFactory.kt) 进行查看。
|
||||
详情可 [点击这里](https://github.com/fankes/YukiHookAPI/blob/master/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/type/android/ComponentTypeFactory.kt) 进行查看。
|
@@ -12,4 +12,4 @@ pageClass: code-page
|
||||
|
||||
> 这是一个预置反射类型的常量类,主要为 `Android` 相关 `Graphics` 的 `Class` 内容,跟随版本更新会逐一进行增加。
|
||||
|
||||
详情可 [点击这里](https://github.com/fankes/YukiHookAPI/blob/master/yukihookapi/src/main/java/com/highcapable/yukihookapi/hook/type/android/GraphicsTypeFactory.kt) 进行查看。
|
||||
详情可 [点击这里](https://github.com/fankes/YukiHookAPI/blob/master/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/type/android/GraphicsTypeFactory.kt) 进行查看。
|
@@ -12,4 +12,4 @@ pageClass: code-page
|
||||
|
||||
> 这是一个预置反射类型的常量类,主要为 `Android` 相关 `Widget` 的 `Class` 内容,跟随版本更新会逐一进行增加。
|
||||
|
||||
详情可 [点击这里](https://github.com/fankes/YukiHookAPI/blob/master/yukihookapi/src/main/java/com/highcapable/yukihookapi/hook/type/android/ViewTypeFactory.kt) 进行查看。
|
||||
详情可 [点击这里](https://github.com/fankes/YukiHookAPI/blob/master/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/type/android/ViewTypeFactory.kt) 进行查看。
|
@@ -12,4 +12,4 @@ pageClass: code-page
|
||||
|
||||
> 这是一个预置反射类型的常量类,主要为 `Java` 相关基本变量类型的 `Class` 内容,跟随版本更新会逐一进行增加。
|
||||
|
||||
详情可 [点击这里](https://github.com/fankes/YukiHookAPI/blob/master/yukihookapi/src/main/java/com/highcapable/yukihookapi/hook/type/java/VariableTypeFactory.kt) 进行查看。
|
||||
详情可 [点击这里](https://github.com/fankes/YukiHookAPI/blob/master/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/type/java/VariableTypeFactory.kt) 进行查看。
|
@@ -4,24 +4,26 @@
|
||||
|
||||
在使用以下功能之前,为防止资源 ID 互相冲突,你需要在当前 Xposed 模块项目的 `build.gradle` 中修改资源 ID。
|
||||
|
||||
- Kotlin Gradle DSL
|
||||
> Kotlin DSL
|
||||
|
||||
```kotlin
|
||||
android {
|
||||
androidResources.additionalParameters("--allow-reserved-package-id", "--package-id", "0x64")
|
||||
androidResources.additionalParameters += listOf("--allow-reserved-package-id", "--package-id", "0x64")
|
||||
}
|
||||
```
|
||||
|
||||
- Groovy
|
||||
> Groovy DSL
|
||||
|
||||
```groovy
|
||||
android {
|
||||
aaptOptions.additionalParameters '--allow-reserved-package-id', '--package-id', '0x64'
|
||||
androidResources.additionalParameters += ['--allow-reserved-package-id', '--package-id', '0x64']
|
||||
}
|
||||
```
|
||||
|
||||
::: warning
|
||||
|
||||
过往版本中的 **aaptOptions.additionalParameters** 已被作废,请参考上述写法并保持你的 **Android Gradle Plugin** 为最新版本。
|
||||
|
||||
提供的示例资源 ID 值仅供参考,不可使用 **0x7f**,默认为 **0x64**,为了防止当前宿主存在多个 Xposed 模块,建议自定义你自己的资源 ID。
|
||||
|
||||
:::
|
||||
@@ -282,7 +284,7 @@ injectMember {
|
||||
|
||||
::: warning 可能存在的问题
|
||||
|
||||
由于一些 APP 自身使用的 **androidx** 依赖库或自定义主题可能会对当前 **MaterialAlertDialog** 实际样式造成干扰,例如对话框的按钮样式,这种情况你可以参考 **模块 Demo** 中 [这里的示例代码](https://github.com/fankes/YukiHookAPI/tree/master/demo-module/src/main/java/com/highcapable/yukihookapi/demo_module/hook/factory/ComponentCompatFactory.kt) 来修复这个问题。
|
||||
由于一些 APP 自身使用的 **androidx** 依赖库或自定义主题可能会对当前 **MaterialAlertDialog** 实际样式造成干扰,例如对话框的按钮样式,这种情况你可以参考 **模块 Demo** 中 [这里的示例代码](https://github.com/fankes/YukiHookAPI/tree/master/samples/demo-module/src/main/java/com/highcapable/yukihookapi/demo_module/hook/factory/ComponentCompatFactory.kt) 来修复这个问题。
|
||||
|
||||
某些 APP 在创建时可能会发生 **ClassCastException** 异常,请手动指定新的 **Configuration** 实例来进行修复。
|
||||
|
||||
|
@@ -60,9 +60,9 @@ resources().hook {
|
||||
|
||||
> 你可以在下方找到 API 提供的 Demo 来学习 `YukiHookAPI` 的使用方法。
|
||||
|
||||
- 宿主 APP Demo [点击这里查看](https://github.com/fankes/YukiHookAPI/tree/master/demo-app)
|
||||
- 宿主 APP Demo [点击这里查看](https://github.com/fankes/YukiHookAPI/tree/master/samples/demo-app)
|
||||
|
||||
- 模块 APP Demo [点击这里查看](https://github.com/fankes/YukiHookAPI/tree/master/demo-module)
|
||||
- 模块 APP Demo [点击这里查看](https://github.com/fankes/YukiHookAPI/tree/master/samples/demo-module)
|
||||
|
||||
同时安装宿主和模块 Demo,通过激活模块来测试宿主中被 Hook 的功能。
|
||||
|
||||
|
@@ -22,7 +22,7 @@
|
||||
|
||||
文档全部的 Demo 示例代码都将使用 `Kotlin` 进行描述,如果你完全不会使用 `Kotlin` 那你将有可能无法使用 `YukiHookAPI`。
|
||||
|
||||
部分 Java Demo 代码可在 [这里](https://github.com/fankes/YukiHookAPI/tree/master/demo-module/src/main/java/com/highcapable/yukihookapi/demo_module/hook/java) 找到,但不推荐使用。
|
||||
部分 Java Demo 代码可在 [这里](https://github.com/fankes/YukiHookAPI/tree/master/samples/demo-module/src/main/java/com/highcapable/yukihookapi/demo_module/hook/java) 找到,但不推荐使用。
|
||||
|
||||
## 灵感来源
|
||||
|
||||
|
@@ -4,7 +4,7 @@
|
||||
|
||||
## 环境要求
|
||||
|
||||
- Windows 7 及以上/macOS 10.14 及以上/Linux 发行版(Arch/Debian)
|
||||
- Windows 7 及以上/macOS 10.14 及以上/Linux 发行版 (Arch/Debian)
|
||||
|
||||
- Android Studio 2021.1 及以上
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
- Gradle 7.0 及以上
|
||||
|
||||
- Jvm 11 及以上 (Since API `1.0.80`)
|
||||
- Java 11 及以上 (Since API `1.0.80`)
|
||||
|
||||
## 自动构建项目
|
||||
|
||||
@@ -34,26 +34,115 @@
|
||||
|
||||
### 集成依赖
|
||||
|
||||
在你的项目 `build.gradle` 中添加依赖。
|
||||
我们推荐使用 Kotlin DSL 作为 Gradle 构建脚本语言并推荐使用 [SweetDependency](https://github.com/HighCapable/SweetDependency) 来管理依赖。
|
||||
|
||||
#### SweetDependency 方式
|
||||
|
||||
在你的项目 `SweetDependency` 配置文件中添加存储库和依赖。
|
||||
|
||||
> 示例如下
|
||||
|
||||
```yaml
|
||||
repositories:
|
||||
#❗作为 Xposed 模块使用务必添加,其它情况可选
|
||||
rovo89-xposed-api:
|
||||
url: https://api.xposed.info/
|
||||
# MavenCentral 有 2 小时缓存,若无法集成最新版本请添加
|
||||
sonatype-oss-releases:
|
||||
|
||||
plugins:
|
||||
#❗作为 Xposed 模块使用务必添加,其它情况可选
|
||||
com.google.devtools.ksp:
|
||||
version: +
|
||||
...
|
||||
|
||||
libraries:
|
||||
#❗作为 Xposed 模块使用务必添加,其它情况可选
|
||||
de.robv.android.xposed:
|
||||
api:
|
||||
version: 82
|
||||
repositories:
|
||||
rovo89-xposed-api
|
||||
com.highcapable.yukihookapi:
|
||||
api:
|
||||
version: +
|
||||
#❗作为 Xposed 模块使用务必添加,其它情况可选
|
||||
ksp-xposed:
|
||||
version-ref: <this>::api
|
||||
...
|
||||
```
|
||||
|
||||
添加完成后运行一次 Gradle Sync,所有依赖版本将自动装配。
|
||||
|
||||
接下来,在你的项目 `build.gradle.kts` 中部署插件。
|
||||
|
||||
> 示例如下
|
||||
|
||||
```kotlin
|
||||
plugins {
|
||||
// ❗作为 Xposed 模块使用务必添加,其它情况可选
|
||||
autowire(libs.plugins.com.google.devtools.ksp)
|
||||
// ...
|
||||
}
|
||||
```
|
||||
|
||||
然后,在你的项目 `build.gradle.kts` 中部署依赖。
|
||||
|
||||
> 示例如下
|
||||
|
||||
```kotlin
|
||||
dependencies {
|
||||
// 基础依赖
|
||||
implementation(com.highcapable.yukihookapi.api)
|
||||
// ❗作为 Xposed 模块使用务必添加,其它情况可选
|
||||
compileOnly(de.robv.android.xposed.api)
|
||||
// ❗作为 Xposed 模块使用务必添加,其它情况可选
|
||||
ksp(com.highcapable.yukihookapi.ksp.xposed)
|
||||
}
|
||||
```
|
||||
|
||||
#### 传统方式 (不推荐)
|
||||
|
||||
在你的项目 `build.gradle.kts` 或 `build.gradle` 中添加存储库。
|
||||
|
||||
> Kotlin DSL
|
||||
|
||||
```kotlin
|
||||
repositories {
|
||||
google()
|
||||
mavenCentral()
|
||||
// ❗作为 Xposed 模块使用务必添加,其它情况可选
|
||||
maven { url("https://api.xposed.info/") }
|
||||
// MavenCentral 有 2 小时缓存,若无法集成最新版本请添加此地址
|
||||
maven { url("https://s01.oss.sonatype.org/content/repositories/releases/") }
|
||||
}
|
||||
```
|
||||
|
||||
> Groovy DSL
|
||||
|
||||
```groovy
|
||||
repositories {
|
||||
google()
|
||||
mavenCentral()
|
||||
// ❗若你的 Plugin 版本过低,作为 Xposed 模块使用务必添加,其它情况可选
|
||||
maven { url "https://dl.bintray.com/kotlin/kotlin-eap" }
|
||||
// ❗作为 Xposed 模块使用务必添加,其它情况可选
|
||||
maven { url "https://api.xposed.info/" }
|
||||
maven { url 'https://api.xposed.info/' }
|
||||
// MavenCentral 有 2 小时缓存,若无法集成最新版本请添加此地址
|
||||
maven { url "https://s01.oss.sonatype.org/content/repositories/releases" }
|
||||
maven { url 'https://s01.oss.sonatype.org/content/repositories/releases/' }
|
||||
}
|
||||
```
|
||||
|
||||
在你的 app `build.gradle` 中添加 `plugin`。
|
||||
在你的项目 `build.gradle.kts` 或 `build.gradle` 中添加插件。
|
||||
|
||||
> 示例如下
|
||||
> Kotlin DSL
|
||||
|
||||
```kotlin
|
||||
plugins {
|
||||
// ❗作为 Xposed 模块使用务必添加,其它情况可选
|
||||
id("com.google.devtools.ksp") version "<ksp-version>"
|
||||
}
|
||||
```
|
||||
|
||||
> Groovy DSL
|
||||
|
||||
```groovy
|
||||
plugins {
|
||||
@@ -62,9 +151,22 @@ plugins {
|
||||
}
|
||||
```
|
||||
|
||||
在你的 app `build.gradle` 中添加依赖。
|
||||
在你的项目 `build.gradle.kts` 或 `build.gradle` 中添加依赖。
|
||||
|
||||
> 示例如下
|
||||
> Kotlin DSL
|
||||
|
||||
```kotlin
|
||||
dependencies {
|
||||
// 基础依赖
|
||||
implementation("com.highcapable.yukihookapi:api:<yuki-version>")
|
||||
// ❗作为 Xposed 模块使用务必添加,其它情况可选
|
||||
compileOnly("de.robv.android.xposed:api:82")
|
||||
// ❗作为 Xposed 模块使用务必添加,其它情况可选
|
||||
ksp("com.highcapable.yukihookapi:ksp-xposed:<yuki-version>")
|
||||
}
|
||||
```
|
||||
|
||||
> Groovy DSL
|
||||
|
||||
```groovy
|
||||
dependencies {
|
||||
@@ -85,11 +187,29 @@ dependencies {
|
||||
|
||||
**YukiHookAPI** 的 **api** 与 **ksp-xposed** 依赖的版本必须一一对应,否则将会造成版本不匹配错误。
|
||||
|
||||
我们推荐使用 [SweetDependency](https://github.com/HighCapable/SweetDependency) 来自动帮你装配依赖。
|
||||
|
||||
:::
|
||||
|
||||
在你的 app `build.gradle` 中修改 `Kotlin` 的 Jvm 版本为 11 及以上。
|
||||
#### 配置 Java 版本
|
||||
|
||||
> 示例如下
|
||||
在你的项目 `build.gradle.kts` 或 `build.gradle` 中修改 Kotlin 的 Java 版本为 11 及以上。
|
||||
|
||||
> Kotlin DSL
|
||||
|
||||
```kt
|
||||
android {
|
||||
compileOptions {
|
||||
sourceCompatibility = JavaVersion.VERSION_11
|
||||
targetCompatibility = JavaVersion.VERSION_11
|
||||
}
|
||||
kotlinOptions {
|
||||
jvmTarget = "11"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
> Groovy DSL
|
||||
|
||||
```groovy
|
||||
android {
|
||||
@@ -105,7 +225,7 @@ android {
|
||||
|
||||
::: warning
|
||||
|
||||
自 API **1.0.80** 版本后 Jvm 版本默认为 11,不再支持 1.8 及以下版本。
|
||||
自 API **1.0.80** 版本后 Kotlin 使用的 Java 版本默认为 11,不再支持 1.8 及以下版本。
|
||||
|
||||
:::
|
||||
|
||||
|
Reference in New Issue
Block a user