Getting started
Requires Android API 26 or later.
Add the dependencies
priv-ui includes the Compose authorization page and exposes priv-core; no separate Core dependency is needed.
dependencies {
implementation("io.github.priv-kit:priv-ui:<version>")
}Choose priv-core directly for an application-owned authorization interface:
dependencies {
implementation("io.github.priv-kit:priv-core:<version>")
}Configure native library packaging
Apps that support Android versions below 10 must set useLegacyPackaging to true:
android {
packaging {
jniLibs {
useLegacyPackaging = true
}
}
}Android 10 and later have no such restriction. Priv Kit uses the startup command that matches the value of useLegacyPackaging.
For example, on an arm64 device:
useLegacyPackaging = true:
adb shell /data/app/.../lib/arm64/libprivkitstarter.souseLegacyPackaging = false:
adb shell /system/bin/linker64 '/data/app/.../base.apk!/lib/arm64-v8a/libprivkitstarter.so'Configure hidden API access
Configure HiddenApiBypass in the host app:
class App : Application() {
override fun attachBaseContext(base: Context?) {
super.attachBaseContext(base)
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
HiddenApiBypass.addHiddenApiExemptions("L")
}
}
}Embed Privilege UI
Place PrivilegeScaffold in the app's Compose content:
PrivilegeScaffold()The default page provides Root, ADB, and Manual startup. See Privilege UI for pairing, configuration, and silent startup.
Build a custom interface with priv-core
With priv-core, your app handles permissions, pairing, confirmations, polling, and errors.
The shortest Root and Wireless Debugging calls are:
val rootServer = Privilege.startRoot()
val adbServer = Privilege.startAdb()Both are suspend APIs. Cancelling the owning coroutine closes the active process, socket, or discovery session. See startup methods for the complete priv-core flows.
Choose a usage mode
- Use Binder for explicit raw Binder access.
- Use the file proxy for basic absolute-path file access.
- Use commands for a bounded non-interactive process with streaming or captured output.
- Use UserService for an app-defined AIDL service.
- Use Privilege UI for the supplied authorization page.
- Read startup methods before replacing that page with a custom
priv-coreintegration.
Active development
Use published versions and documented APIs. priv-evdev is experimental; internal classes have no compatibility guarantee.