import{_ as o,r as l,o as i,c as p,b as n,d as t,a as e,e as s}from"./app.78a03919.js";const r={},c=e(`<h1 id="quick-start" tabindex="-1"><a class="header-anchor" href="#quick-start" aria-hidden="true">#</a> Quick Start</h1><blockquote><p>Integrate <code>YukiHookAPI</code> into your project.</p></blockquote><h2 id="environment-requirements" tabindex="-1"><a class="header-anchor" href="#environment-requirements" aria-hidden="true">#</a> Environment Requirements</h2><ul><li><p>Windows 7 and above / macOS 10.14 and above / Linux distributions (Arch/Debian)</p></li><li><p>Android Studio 2021.1 and above</p></li><li><p>IntelliJ IDEA 2021.1 and above</p></li><li><p>Kotlin 1.7.0 and above</p></li><li><p>Android Gradle Plugin 7.0 and above</p></li><li><p>Gradle 7.0 and above</p></li><li><p>JVM 11 and above (Since API <code>1.0.80</code>)</p></li></ul><h2 id="automatically-build-project" tabindex="-1"><a class="header-anchor" href="#automatically-build-project" aria-hidden="true">#</a> Automatically Build Project</h2><p><code>YukiHookAPI</code> 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.</p><p>You can <a href="../tools/yukihookapi-projectbuilder">click here</a> to check it out.</p><h2 id="manually-configure-project" tabindex="-1"><a class="header-anchor" href="#manually-configure-project" aria-hidden="true">#</a> Manually Configure Project</h2><p>If you don&#39;t want to use automated build tools, you can still manually configure project dependencies as follows.</p><h3 id="create-project" tabindex="-1"><a class="header-anchor" href="#create-project" aria-hidden="true">#</a> Create Project</h3><p>Use <code>Android Studio</code> or <code>IntelliJ IDEA</code> to create a new Android project and select <code>Kotlin</code> in the <code>Language</code> column to automatically add basic dependencies.</p><h3 id="integration-dependencies" tabindex="-1"><a class="header-anchor" href="#integration-dependencies" aria-hidden="true">#</a> Integration Dependencies</h3><p>Add dependencies to your project <code>build.gradle</code>.</p><blockquote><p>The following example</p></blockquote><div class="language-groovy ext-groovy line-numbers-mode"><pre class="shiki" style="background-color:#22272e;"><code><span class="line"><span style="color:#ADBAC7;">repositories {</span></span>
<span class="line"><span style="color:#ADBAC7;">    google()</span></span>
<span class="line"><span style="color:#ADBAC7;">    mavenCentral()</span></span>
<span class="line"><span style="color:#ADBAC7;">    </span><span style="color:#768390;">// \u2757If your Plugin version is too low, be sure to add it as an Xposed Module, other cases are optional</span></span>
<span class="line"><span style="color:#ADBAC7;">    maven { url </span><span style="color:#96D0FF;">&quot;https://dl.bintray.com/kotlin/kotlin-eap&quot;</span><span style="color:#ADBAC7;"> }</span></span>
<span class="line"><span style="color:#ADBAC7;">    </span><span style="color:#768390;">// \u2757Be sure to add it as an Xposed Module, optional in other cases</span></span>
<span class="line"><span style="color:#ADBAC7;">    maven { url </span><span style="color:#96D0FF;">&quot;https://api.xposed.info/&quot;</span><span style="color:#ADBAC7;"> }</span></span>
<span class="line"><span style="color:#ADBAC7;">    </span><span style="color:#768390;">// MavenCentral has a 2-hour cache, if you cannot integrate the latest version, please add this address</span></span>
<span class="line"><span style="color:#ADBAC7;">    maven { url </span><span style="color:#96D0FF;">&quot;https://s01.oss.sonatype.org/content/repositories/releases&quot;</span><span style="color:#ADBAC7;"> }</span></span>
<span class="line"><span style="color:#ADBAC7;">}</span></span>
<span class="line"></span></code></pre><div class="line-numbers" aria-hidden="true"><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div></div></div><p>Add <code>plugin</code> to your app <code>build.gradle</code>.</p><blockquote><p>The following example</p></blockquote><div class="language-groovy ext-groovy line-numbers-mode"><pre class="shiki" style="background-color:#22272e;"><code><span class="line"><span style="color:#ADBAC7;">plugins {</span></span>
<span class="line"><span style="color:#ADBAC7;">    </span><span style="color:#768390;">// \u2757Be sure to add it as an Xposed Module, optional in other cases</span></span>
<span class="line"><span style="color:#ADBAC7;">    id </span><span style="color:#96D0FF;">&#39;com.google.devtools.ksp&#39;</span><span style="color:#ADBAC7;"> version </span><span style="color:#96D0FF;">&#39;&lt;ksp-version&gt;&#39;</span></span>
<span class="line"><span style="color:#ADBAC7;">}</span></span>
<span class="line"></span></code></pre><div class="line-numbers" aria-hidden="true"><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div></div></div><p>Add dependencies to your app <code>build.gradle</code>.</p><blockquote><p>The following example</p></blockquote><div class="language-groovy ext-groovy line-numbers-mode"><pre class="shiki" style="background-color:#22272e;"><code><span class="line"><span style="color:#ADBAC7;">dependencies {</span></span>
<span class="line"><span style="color:#ADBAC7;">    </span><span style="color:#768390;">// base dependencies</span></span>
<span class="line"><span style="color:#ADBAC7;">    implementation </span><span style="color:#96D0FF;">&#39;com.highcapable.yukihookapi:api:&lt;yuki-version&gt;&#39;</span></span>
<span class="line"><span style="color:#ADBAC7;">    </span><span style="color:#768390;">// \u2757Be sure to add it as an Xposed Module, optional in other cases</span></span>
<span class="line"><span style="color:#ADBAC7;">    compileOnly </span><span style="color:#96D0FF;">&#39;de.robv.android.xposed:api:82&#39;</span></span>
<span class="line"><span style="color:#ADBAC7;">    </span><span style="color:#768390;">// \u2757Be sure to add it as an Xposed Module, optional in other cases</span></span>
<span class="line"><span style="color:#ADBAC7;">    ksp </span><span style="color:#96D0FF;">&#39;com.highcapable.yukihookapi:ksp-xposed:&lt;yuki-version&gt;&#39;</span></span>
<span class="line"><span style="color:#ADBAC7;">}</span></span>
<span class="line"></span></code></pre><div class="line-numbers" aria-hidden="true"><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div></div></div>`,21),d=s("Please modify "),u=n("strong",null,"<ksp-version>",-1),y=s(" to the latest version from "),v={href:"https://github.com/google/ksp/releases",target:"_blank",rel:"noopener noreferrer"},A=s("here"),m=s(),h=n("strong",null,"(Please choose your current corresponding Kotlin version)",-1),b=s("."),g=e(`<p>Please modify <strong>&lt;yuki-version&gt;</strong> to the latest version <a href="../about/changelog">here</a>.</p><div class="custom-container danger"><p class="custom-container-title">Pay Attention</p><p>The <strong>api</strong> of <strong>YukiHookAPI</strong> and the versions that <strong>ksp-xposed</strong> depend on must correspond one by one, otherwise a version mismatch error will occur.</p></div><p>Modify the JVM version of <code>Kotlin</code> to 11 and above in your app <code>build.gradle</code>.</p><blockquote><p>The following example</p></blockquote><div class="language-groovy ext-groovy line-numbers-mode"><pre class="shiki" style="background-color:#22272e;"><code><span class="line"><span style="color:#ADBAC7;">android {</span></span>
<span class="line"><span style="color:#ADBAC7;">    compileOptions {</span></span>
<span class="line"><span style="color:#ADBAC7;">        sourceCompatibility </span><span style="color:#F47067;">JavaVersion.</span><span style="color:#6CB6FF;">VERSION_11</span></span>
<span class="line"><span style="color:#ADBAC7;">        targetCompatibility </span><span style="color:#F47067;">JavaVersion.</span><span style="color:#6CB6FF;">VERSION_11</span></span>
<span class="line"><span style="color:#ADBAC7;">    }</span></span>
<span class="line"><span style="color:#ADBAC7;">    kotlinOptions {</span></span>
<span class="line"><span style="color:#ADBAC7;">        jvmTarget </span><span style="color:#F47067;">=</span><span style="color:#ADBAC7;"> </span><span style="color:#96D0FF;">&#39;11&#39;</span></span>
<span class="line"><span style="color:#ADBAC7;">    }</span></span>
<span class="line"><span style="color:#ADBAC7;">}</span></span>
<span class="line"></span></code></pre><div class="line-numbers" aria-hidden="true"><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div></div></div><div class="custom-container warning"><p class="custom-container-title">Notice</p><p>Since API <strong>1.0.80</strong> version, the default JVM version is 11, and 1.8 and below are no longer supported.</p></div><h3 id="use-as-xposed-module" tabindex="-1"><a class="header-anchor" href="#use-as-xposed-module" aria-hidden="true">#</a> Use as Xposed Module</h3><p>Add the base code to your <code>AndroidManifest.xml</code>.</p><blockquote><p>The following example</p></blockquote><div class="language-xml ext-xml line-numbers-mode"><pre class="shiki" style="background-color:#22272e;"><code><span class="line"><span style="color:#768390;">&lt;!-- Set as Xposed Module --&gt;</span></span>
<span class="line"><span style="color:#ADBAC7;">&lt;</span><span style="color:#8DDB8C;">meta-data</span></span>
<span class="line"><span style="color:#ADBAC7;">    </span><span style="color:#6CB6FF;">android:name</span><span style="color:#ADBAC7;">=</span><span style="color:#96D0FF;">&quot;xposedmodule&quot;</span></span>
<span class="line"><span style="color:#ADBAC7;">    </span><span style="color:#6CB6FF;">android:value</span><span style="color:#ADBAC7;">=</span><span style="color:#96D0FF;">&quot;true&quot;</span><span style="color:#ADBAC7;"> /&gt;</span></span>
<span class="line"></span>
<span class="line"><span style="color:#768390;">&lt;!-- Set your module description --&gt;</span></span>
<span class="line"><span style="color:#ADBAC7;">&lt;</span><span style="color:#8DDB8C;">meta-data</span></span>
<span class="line"><span style="color:#ADBAC7;">    </span><span style="color:#6CB6FF;">android:name</span><span style="color:#ADBAC7;">=</span><span style="color:#96D0FF;">&quot;xposeddescription&quot;</span></span>
<span class="line"><span style="color:#ADBAC7;">    </span><span style="color:#6CB6FF;">android:value</span><span style="color:#ADBAC7;">=</span><span style="color:#96D0FF;">&quot;Fill in your Xposed Module description&quot;</span><span style="color:#ADBAC7;"> /&gt;</span></span>
<span class="line"></span>
<span class="line"><span style="color:#768390;">&lt;!-- The minimum Xposed version number --&gt;</span></span>
<span class="line"><span style="color:#768390;">&lt;!-- If you are using EdXposed/LSPosed, the minimum recommended is 93 --&gt;</span></span>
<span class="line"><span style="color:#ADBAC7;">&lt;</span><span style="color:#8DDB8C;">meta-data</span></span>
<span class="line"><span style="color:#ADBAC7;">    </span><span style="color:#6CB6FF;">android:name</span><span style="color:#ADBAC7;">=</span><span style="color:#96D0FF;">&quot;xposedminversion&quot;</span></span>
<span class="line"><span style="color:#ADBAC7;">    </span><span style="color:#6CB6FF;">android:value</span><span style="color:#ADBAC7;">=</span><span style="color:#96D0FF;">&quot;93&quot;</span><span style="color:#ADBAC7;"> /&gt;</span></span>
<span class="line"></span>
<span class="line"><span style="color:#768390;">&lt;!-- Optional: Configure support for New XSharePrefs without adjusting xposedminversion to 93 --&gt;</span></span>
<span class="line"><span style="color:#ADBAC7;">&lt;</span><span style="color:#8DDB8C;">meta-data</span></span>
<span class="line"><span style="color:#ADBAC7;">    </span><span style="color:#6CB6FF;">android:name</span><span style="color:#ADBAC7;">=</span><span style="color:#96D0FF;">&quot;xposedsharedprefs&quot;</span></span>
<span class="line"><span style="color:#ADBAC7;">    </span><span style="color:#6CB6FF;">android:value</span><span style="color:#ADBAC7;">=</span><span style="color:#96D0FF;">&quot;true&quot;</span><span style="color:#ADBAC7;">/&gt;</span></span>
<span class="line"></span></code></pre><div class="line-numbers" aria-hidden="true"><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div></div></div><p>Create a Hook entry class in your project, implements <code>IYukiHookXposedInit</code> and add the annotation <code>@InjectYukiHookWithXposed</code>.</p><blockquote><p>The following example</p></blockquote><div class="language-kotlin ext-kt line-numbers-mode"><pre class="shiki" style="background-color:#22272e;"><code><span class="line"><span style="color:#F47067;">@InjectYukiHookWithXposed</span></span>
<span class="line"><span style="color:#F47067;">class</span><span style="color:#ADBAC7;"> </span><span style="color:#F69D50;">HookEntry</span><span style="color:#ADBAC7;"> </span><span style="color:#F47067;">:</span><span style="color:#ADBAC7;"> </span><span style="color:#6CB6FF;">IYukiHookXposedInit</span><span style="color:#ADBAC7;"> {</span></span>
<span class="line"></span>
<span class="line"><span style="color:#ADBAC7;">    </span><span style="color:#F47067;">override</span><span style="color:#ADBAC7;"> </span><span style="color:#F47067;">fun</span><span style="color:#ADBAC7;"> </span><span style="color:#DCBDFB;">onHook</span><span style="color:#ADBAC7;">() </span><span style="color:#F47067;">=</span><span style="color:#ADBAC7;"> </span><span style="color:#F69D50;">YukiHookAPI</span><span style="color:#ADBAC7;">.encase {</span></span>
<span class="line"><span style="color:#ADBAC7;">        </span><span style="color:#768390;">// Your code here.</span></span>
<span class="line"><span style="color:#ADBAC7;">    }</span></span>
<span class="line"><span style="color:#ADBAC7;">}</span></span>
<span class="line"></span></code></pre><div class="line-numbers" aria-hidden="true"><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div></div></div><div class="custom-container tip"><p class="custom-container-title">Suggestion</p><p>You can extends <strong>Application</strong> of your Module App from <strong>ModuleApplication</strong> to achieve a complete user experience.</p><p>For more functions, please refer to <a href="../api/public/com/highcapable/yukihookapi/hook/xposed/application/ModuleApplication">ModuleApplication</a>.</p></div><p>Then, you can start writing Hook code.</p><p>For configuration details related to use as an Xposed Module, you can <a href="../config/xposed-using">click here</a> to continue reading.</p><p>If you are currently using Xposed API, you can refer to <a href="../guide/move-to-new-api">Migrate from Xposed API</a>.</p><h3 id="use-as-hook-api" tabindex="-1"><a class="header-anchor" href="#use-as-hook-api" aria-hidden="true">#</a> Use as Hook API</h3><h4 id="integration" tabindex="-1"><a class="header-anchor" href="#integration" aria-hidden="true">#</a> Integration</h4><p>Create your custom <code>Application</code>.</p><div class="custom-container danger"><p class="custom-container-title">Pay Attention</p><p>Regardless of the <strong>Hook Framework</strong> you use, you need to add its docking Xposed dependency support.</p><p>If the target <strong>Hook Framework</strong> does not integrate Xposed API, you need to implement and connect <strong>XposedBridge</strong> by yourself.</p></div><p>Add <code>YukiHookAPI.encase</code> method to <code>attachBaseContext</code>.</p><blockquote><p>The following example</p></blockquote><div class="language-kotlin ext-kt line-numbers-mode"><pre class="shiki" style="background-color:#22272e;"><code><span class="line"><span style="color:#F47067;">override</span><span style="color:#ADBAC7;"> </span><span style="color:#F47067;">fun</span><span style="color:#ADBAC7;"> </span><span style="color:#DCBDFB;">attachBaseContext</span><span style="color:#ADBAC7;">(base</span><span style="color:#F47067;">:</span><span style="color:#ADBAC7;"> </span><span style="color:#F69D50;">Context?</span><span style="color:#ADBAC7;">) {</span></span>
<span class="line"><span style="color:#ADBAC7;">    </span><span style="color:#768390;">// Load Hook Framework</span></span>
<span class="line"><span style="color:#ADBAC7;">    </span><span style="color:#768390;">//</span></span>
<span class="line"><span style="color:#ADBAC7;">    </span><span style="color:#768390;">// Your code here.</span></span>
<span class="line"><span style="color:#ADBAC7;">    </span><span style="color:#768390;">//</span></span>
<span class="line"><span style="color:#ADBAC7;">    </span><span style="color:#768390;">// Load YukiHookAPI</span></span>
<span class="line"><span style="color:#ADBAC7;">    </span><span style="color:#F69D50;">YukiHookAPI</span><span style="color:#ADBAC7;">.encase(base) {</span></span>
<span class="line"><span style="color:#ADBAC7;">        </span><span style="color:#768390;">// Your code here.</span></span>
<span class="line"><span style="color:#ADBAC7;">    }</span></span>
<span class="line"><span style="color:#ADBAC7;">    </span><span style="color:#6CB6FF;">super</span><span style="color:#ADBAC7;">.attachBaseContext(base)</span></span>
<span class="line"><span style="color:#ADBAC7;">}</span></span>
<span class="line"></span></code></pre><div class="line-numbers" aria-hidden="true"><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div></div></div><p>Then, you can start writing Hook code in much the same way you would use it as an Xposed Module.</p><p>For configuration details related to use as a Hook API, you can <a href="../config/api-using">click here</a> to continue reading.</p><div class="custom-container warning"><p class="custom-container-title">Notice</p><p><strong>YukiHookModuleStatus</strong>, <strong>YukiHookModulePrefs</strong>, <strong>YukiHookDataChannel</strong> and Resources Hook functionality will not work when using a custom Hook Framework instead of the full Xposed Module.</p></div>`,27);function D(C,B){const a=l("ExternalLinkIcon");return i(),p("div",null,[c,n("p",null,[d,u,y,n("a",v,[A,t(a)]),m,h,b]),g])}const F=o(r,[["render",D],["__file","quick-start.html.vue"]]);export{F as default};
