import{_ as l,r as p,o as c,c as i,b as s,d as n,e,a as o}from"./app-BpUB8-Q8.js";const r={},t=o(`
作为 Hook API 通常为做自身 APP 热更新或功能需要以及产品测试的 Hook 操作。
你只需要集成 com.highcapable.yukihookapi:api
依赖即可。
然后请集成你目标使用的 Hook Framework
依赖。
创建你的自定义 Application
。
在 attachBaseContext
中添加 YukiHookAPI.encase
方法。
示例如下
class MyApplication : Application() {
override fun attachBaseContext(base: Context?) {
// 装载 Hook Framework
//
// Your code here.
//
// 配置 YukiHookAPI
YukiHookApi.configs {
// Your code here.
}
// 装载 YukiHookAPI
YukiHookAPI.encase(base) {
// Your code here.
}
super.attachBaseContext(base)
}
}
这样,你就完成了 API 的相关配置。
你可以 点击这里 查看异同点和注意事项。
注意
你不能再使用 loadApp 进行包装,可直接开始编写你的 Hook 代码。
`,15),d={id:"pine",tabindex:"-1"},A=s("a",{class:"header-anchor",href:"#pine","aria-hidden":"true"},"#",-1),y={href:"https://github.com/canyie/pine",target:"_blank",rel:"noopener noreferrer"},u=o(`这里给出了一些较高使用率的
Hook Framework
如何对接YukiHookAPI
的相关方式。
所需 Xposed API 依赖
top.canyie.pine:xposed
示例如下
override fun attachBaseContext(base: Context?) {
// 装载 Pine
PineConfig.debug = true
PineConfig.debuggable = BuildConfig.DEBUG
// 装载 YukiHookAPI
YukiHookAPI.encase(base) {
// Your code here.
}
super.attachBaseContext(base)
}
所需 Xposed API 依赖
com.swift.sandhook:xposedcompat
或com.swift.sandhook:xposedcompat_new
示例如下
override fun attachBaseContext(base: Context?) {
// 装载 SandHook
SandHookConfig.DEBUG = BuildConfig.DEBUG
XposedCompat.cacheDir = base?.cacheDir
XposedCompat.context = base
XposedCompat.classLoader = javaClass.classLoader
XposedCompat.isFirstApplication = base?.processName == base?.packageName
// 装载 YukiHookAPI
YukiHookAPI.encase(base) {
// Your code here.
}
super.attachBaseContext(base)
}
示例如下
override fun attachBaseContext(base: Context?) {
// 装载 Whale 不需要任何配置
// 装载 YukiHookAPI
YukiHookAPI.encase(base) {
// Your code here.
}
super.attachBaseContext(base)
}