import{_ as o,r as p,o as i,c as t,b as n,d as s,e,a as l}from"./app-BpUB8-Q8.js";const r={},c=l('

Quick Start

Integrate YukiHookAPI into your project.

Project Requirements

The project needs to be created using Android Studio or IntelliJ IDEA and be of type Android project and have integrated Kotlin environment dependencies.

',4),d={href:"https://developer.android.com/studio",target:"_blank",rel:"noopener noreferrer"},u={href:"https://www.jetbrains.com/idea",target:"_blank",rel:"noopener noreferrer"},y=n("li",null,[n("p",null,"Kotlin 1.9.0+, Gradle 8+, Java 11, 17+, Android Gradle Plugin 8+")],-1),A=l('

Automatically Build Project

YukiHookAPI provides an automated build tool that can help you quickly build an Android standard project template with Xposed Module dependencies, and use the built template to start the next step directly.

You can click here to check it out.

Manually Configure Project

If you don't want to use automated build tools, you can still manually configure project dependencies as follows.

Create Project

Use Android Studio or IntelliJ IDEA to create a new Android project and select Kotlin in the Language column to automatically add basic dependencies.

Integration Dependencies

',8),v={href:"https://github.com/HighCapable/SweetDependency",target:"_blank",rel:"noopener noreferrer"},D=l(`

Add the repositories and dependencies in your project's SweetDependency configuration file.

The following example

repositories:
  # Must be added when used as an Xposed Module, otherwise optional
  rovo89-xposed-api:
    url: https://api.xposed.info/

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
  # YukiHookAPI version 1.3.0 uses KavaRef as core reflection API
  # YukiHookAPI no longer binds its own reflection API, you can start trying to use KavaRef
  com.highcapable.kavaref:
    kavaref-core:
      version: +
    kavaref-extension:
      version: +
  ...

After adding it, run Gradle Sync and all dependencies will be autowired.

Next, deploy plugins in your project's build.gradle.kts.

The following example

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's build.gradle.kts.

The following example

dependencies {
    // Basic dependencies
    implementation(com.highcapable.yukihookapi.api)
    // It is recommended to use KavaRef as the core reflection API
    implementation(com.highcapable.kavaref.kavaref.core)
    implementation(com.highcapable.kavaref.kavaref.extension)
    // 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)
}

Version Catalog

Add repositories in your project's build.gradle.kts.

Kotlin DSL

repositories {
    google()
    mavenCentral()
    // Must be added when used as an Xposed Module, otherwise optional 
    maven("https://api.xposed.info/")
}

Add dependency in your project's gradle/libs.versions.toml.

The following example

[versions]
yukihookapi = "<yuki-version>"
ksp = "<ksp-version>"
kavaref-core = "<kavaref-version>"
kavaref-extension = "<kavaref-version>"

[plugins]
# Must be added when used as an Xposed Module, otherwise optional
ksp = { id = "com.google.devtools.ksp", version.ref = "ksp" }

[libraries]
yukihookapi-api = { module = "com.highcapable.yukihookapi:api", version.ref = "yukihookapi" }
# Must be added when used as an Xposed Module, otherwise optional
yukihookapi-ksp-xposed = { module = "com.highcapable.yukihookapi:ksp-xposed", version.ref = "yukihookapi" }
# YukiHookAPI version 1.3.0 uses KavaRef as core reflection API
# YukiHookAPI no longer binds its own reflection API, you can start trying to use KavaRef
kavaref-core = { module = "com.highcapable.kavaref:kavaref-core", version.ref = "kavaref-core" }
kavaref-extension = { module = "com.highcapable.kavaref:kavaref-extension", version.ref = "kavaref-extension" }
# Must be added when used as an Xposed Module, otherwise optional
xposed-api = { module = "de.robv.android.xposed:api", version = "82" }

Next, deploy plugins in your project's build.gradle.kts.

Kotlin DSL

plugins {
    // Must be added when used as an Xposed Module, otherwise optional
    alias(libs.plugins.ksp)
}

Then, deploy dependencies in your project's build.gradle.kts.

Kotlin DSL

dependencies {
    // Basic dependency
    implementation(libs.yukihookapi.api)
    // It is recommended to use KavaRef as the core reflection API
    implementation(libs.kavaref.core)
    implementation(libs.kavaref.extension)
    // Must be added when used as an Xposed Module, otherwise optional
    compileOnly(libs.xposed.api)
    // Must be added when used as an Xposed Module, otherwise optional
    ksp(libs.yukihookapi.ksp.xposed)
}

Traditional Method

Add repositories in your project's build.gradle.kts.

Kotlin DSL

repositories {
    google()
    mavenCentral()
    // Must be added when used as an Xposed Module, otherwise optional
    maven("https://api.xposed.info/")
}

Add plugins in your project's build.gradle.kts.

Kotlin DSL

plugins {
    // Must be added when used as an Xposed Module, otherwise optional
    id("com.google.devtools.ksp") version "<ksp-version>"
}

Add dependencies in your project's build.gradle.kts.

Kotlin DSL

dependencies {
    // Basic dependency
    implementation("com.highcapable.yukihookapi:api:<yuki-version>")
    // It is recommended to use KavaRef as the core reflection API
    implementation("com.highcapable.kavaref:kavaref-core:<kavaref-version>")
    implementation("com.highcapable.kavaref:kavaref-extension:<kavaref-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>")
}
`,34),m=n("strong",null,"",-1),b={href:"https://github.com/google/ksp/releases",target:"_blank",rel:"noopener noreferrer"},B=n("strong",null,"(please note to select your current corresponding Kotlin version)",-1),C=n("p",null,[s("Please change "),n("strong",null,""),s(" to the latest version "),n("a",{href:"../about/changelog"},"here"),s(".")],-1),h=n("strong",null,"",-1),k={href:"https://highcapable.github.io/KavaRef/en/about/changelog",target:"_blank",rel:"noopener noreferrer"},g=l(`

Pay Attention

The api and ksp-xposed dependency versions of YukiHookAPI must correspond one-to-one, otherwise a version mismatch error will occur.

Configure Java Version

Modify the Java version of Kotlin in your project build.gradle.kts or build.gradle to 17 or above.

Kotlin DSL

android {
    compileOptions {
        sourceCompatibility = JavaVersion.VERSION_17
        targetCompatibility = JavaVersion.VERSION_17
    }
    kotlinOptions {
        jvmTarget = "17"
    }
}

Groovy DSL

android {
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_17
        targetCompatibility JavaVersion.VERSION_17
    }
    kotlinOptions {
        jvmTarget = '17'
    }
}

Notice

Since API 1.0.80, the Java version used by Kotlin defaults to 11, and versions 1.8 and below are no longer supported.

Since API 1.2.0, the Java version used by Kotlin defaults to 17, and versions 11 and below are no longer supported.

Use as Xposed Module

Add the base code to your AndroidManifest.xml.

The following example

<!-- Set as Xposed Module -->
<meta-data
    android:name="xposedmodule"
    android:value="true" />

<!-- Set your Xposed Module description -->
<meta-data
    android:name="xposeddescription"
    android:value="Fill in your Xposed Module description" />

<!-- The minimum Xposed version number -->
<!-- If you are using EdXposed/LSPosed, the minimum recommended is 93 -->
<meta-data
    android:name="xposedminversion"
    android:value="93" />

<!-- Optional: Configure support for New XSharedPreferences without adjusting xposedminversion to 93 -->
<meta-data
    android:name="xposedsharedprefs"
    android:value="true"/>

Create a Hook entry class in your project, implements IYukiHookXposedInit and add the annotation @InjectYukiHookWithXposed.

The following example

@InjectYukiHookWithXposed
object HookEntry : IYukiHookXposedInit {

    override fun onHook() = YukiHookAPI.encase {
        // Your code here.
    }
}

Suggestion

Please configure YukiHookAPI in the onInit method and set the isDebug mode to the following form.

The following example

override fun onInit() = configs {
    isDebug = BuildConfig.DEBUG
}

You can also extends Application of your Module App from ModuleApplication to achieve a complete user experience.

For more functions, please refer to ModuleApplication.

Then, you can start writing Hook code.

For configuration details related to use as an Xposed Module, you can click here to continue reading.

If you are currently using Hook APIs such as Rovo89 Xposed API, you can refer to Migrate from Other Hook APIs.

Use as Hook API

Integration

Create your custom Application.

Pay Attention

Regardless of the Hook Framework you use, you need to add its docking Xposed dependency support.

If the target Hook Framework does not integrate Rovo89 Xposed API, you need to implement and connect XposedBridge by yourself.

Add YukiHookAPI.encase method to attachBaseContext.

The following example

override fun attachBaseContext(base: Context?) {
    // Load Hook Framework
    //
    // Your code here.
    //
    // Load YukiHookAPI
    YukiHookAPI.encase(base) {
        // Your code here.
    }
    super.attachBaseContext(base)
}

Then, you can start writing Hook code in much the same way you would use it as an Xposed Module.

For configuration details related to use as a Hook API, you can click here to continue reading.

Notice

YukiHookPrefsBridge, YukiHookDataChannel and Resources Hook functionality will not work when using a custom Hook Framework instead of the full Xposed Module.

`,29);function F(f,q){const a=p("ExternalLinkIcon");return i(),t("div",null,[c,n("ul",null,[n("li",null,[n("p",null,[s("Android Studio (It is recommended to get the latest version from "),n("a",d,[s("here"),e(a)]),s(")")])]),n("li",null,[n("p",null,[s("IntelliJ IDEA (It is recommended to get the latest version from "),n("a",u,[s("here"),e(a)]),s(")")])]),y]),A,n("p",null,[s("We recommend using Kotlin DSL as the Gradle build script language and "),n("a",v,[s("SweetDependency"),e(a)]),s(" to manage dependencies.")]),D,n("p",null,[s("Please modify "),m,s(" to the latest version found "),n("a",b,[s("here"),e(a)]),s(),B,s(".")]),C,n("p",null,[s("Please change "),h,s(" to the latest version "),n("a",k,[s("here"),e(a)]),s(".")]),g])}const w=o(r,[["render",F],["__file","quick-start.html.vue"]]);export{w as default};