Skip to content

What is NPatch

NPatch is a rootless Xposed framework powered by the Vector core.

It's a modern Xposed module injection and app patching tool designed for rootless environments. NPatch injects an Xposed loader into APK files without requiring Root: Local mode pairs with the Manager to dynamically load and manage modules and scopes (the Manager does not need to stay running in the background); Integrated mode embeds modules directly into the target app for standalone operation on devices without the Manager.

The core submodule points to HSSkyBoy/Vector — the runtime core that powers all of NPatch's capabilities.

How It Works

The patching process roughly:

  1. Opens the target APK with apkzlib
  2. Rewrites AndroidManifest.xml, replacing appComponentFactory with top.nkbe.npatch.metaloader.LSPAppComponentFactoryStub
  3. Injects the meta-loader dex (assets/npatch/metaloader.dex)
  4. In Local mode (--manager), additionally injects loader dex and libnpatch.so (arm64-v8a and x86_64)
  5. When signature bypass level ≥ Basic, embeds the original APK as a nested zip (assets/npatch/origin.apk) so the original signature can be read at runtime
  6. Re-signs with a keystore, outputting <original-name>-<NPatch versionCode>-npatched.apk

At runtime, the rewritten appComponentFactory bootstraps the Xposed environment first, then hands control back to the app's real component factory. Modules are loaded at that point.

The version number in the output filename suffix is NPatch's own LSConfig.VERSION_CODE, not the original APK's versionCode.

Two Patching Modes

NPatch has two mutually exclusive patching modes:

  • Local Mode (--manager): Patches apps without embedding modules. Xposed scope can be changed dynamically without re-patching. Apps only work with NPatch Manager installed on the same device.
  • Integrated Mode (--embed): Patches apps with modules built in. Patched apps run independently without the Manager but cannot dynamically manage configuration. Ideal for devices without NPatch Manager.

The two flags are mutually exclusive on CLI. See Local & Integrated Modes for details.

System Requirements

  • Android 9 (API 28) or higher
  • Upper bound roughly matches JingMatrix/Vector
  • Patching tool: jar-v<verName>-<verCode>-release.jar (pure Java, cross-platform — runs on Windows / macOS / Linux, requires Java)

Good For

  • Devices without unlocked bootloader, or where Root is unwanted/impossible
  • Injecting Xposed modules into specific user apps only
  • Distributing the same patched APK across multiple devices

Not Good For

  • Modifying system server, framework, or system apps — NPatch only handles user apps
  • Apps with strong integrity checks, SafetyNet / Play Integrity strict verification (e.g., banking apps, some games)
  • Hardened APKs (dex encryption, packer protection) — usually cannot be patched directly

Next Steps

NPatch Official Documentation