mirror of
https://github.com/HighCapable/YukiHookAPI.git
synced 2025-09-09 12:04:07 +08:00
docs: update some functions
This commit is contained in:
@@ -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