
Facilitates Android device connection without ADB server, supporting wireless debugging, apk sideloading, file management, port forwarding, and shell command execution with secure SSL/TLS1.3 connections.
Kadb is a Kotlin Multiplatform ADB client library for talking directly to adbd.
It is intended for apps and tools that need shell, sync, install, pairing, or port forwarding without embedding the full adb CLI or server stack.
adbd
Kadb powers WearOS Toolbox, an Android smartwatch toolbox for connecting to watches, managing apps, and transferring files. Both Kadb and WearOS Toolbox are developed by Flyfish Studio.
dependencies {
implementation("com.flyfishxu:kadb:2.1.5")
}Optional mDNS discovery:
dependencies {
implementation("com.flyfishxu:kadb-mdns:2.1.5")
}Connect to an existing device transport:
Kadb.create("127.0.0.1", 5555).use { kadb ->
val response = kadb.shell("echo hello")
check(response.exitCode == 0)
check(response.output == "hello\n")
}Pair with a new Android 11+ device:
Kadb.pair("10.0.0.175", 37755, "643102")Discover wireless debugging endpoints with the optional mDNS artifact:
val mdns = KadbMdnsAndroid(context)
mdns.start()val mdns = KadbMdnsJvm()
mdns.start()Discovered endpoints can be passed to Kadb.create(host, port) or Kadb.pair(host, port, code).
| Capability | API |
|---|---|
Connect to adbd over TCP |
Kadb.create(...) |
| USB discovery / connection | Platform-specific KadbUsb.devices(...), KadbUsb.create(...)
|
| Wireless pairing | Kadb.pair(...) |
| Shell |
shell(...), openShell(), openPtyShellSession()
|
| File transfer |
push(...), pull(...), openSync()
|
| APK install |
install(...), installMultiple(...), uninstall(...)
|
| Port forwarding | tcpForward(...) |
| Transport reuse | resetConnection() |
| Optional mDNS discovery |
KadbMdnsAndroid, KadbMdnsJvm
|
Install an APK:
Kadb.create("127.0.0.1", 5555).use { kadb ->
kadb.install(apkFile)
}Push a file:
Kadb.create("127.0.0.1", 5555).use { kadb ->
kadb.push(localFile, "/data/local/tmp/remote.txt")
}Forward a TCP port:
Kadb.create("127.0.0.1", 5555).tcpForward(
hostPort = 7001,
targetPort = 7001
).use {
// localhost:7001 now forwards to the device's port 7001
}minSdk 23
adb binaryconscrypt-openjdk-uber
Example JVM pairing dependency:
dependencies {
implementation("com.flyfishxu:kadb:2.1.5")
implementation("org.conscrypt:conscrypt-openjdk-uber:2.5.2")
}Kadb is a Kotlin Multiplatform ADB client library for talking directly to adbd.
It is intended for apps and tools that need shell, sync, install, pairing, or port forwarding without embedding the full adb CLI or server stack.
adbd
Kadb powers WearOS Toolbox, an Android smartwatch toolbox for connecting to watches, managing apps, and transferring files. Both Kadb and WearOS Toolbox are developed by Flyfish Studio.
dependencies {
implementation("com.flyfishxu:kadb:2.1.5")
}Optional mDNS discovery:
dependencies {
implementation("com.flyfishxu:kadb-mdns:2.1.5")
}Connect to an existing device transport:
Kadb.create("127.0.0.1", 5555).use { kadb ->
val response = kadb.shell("echo hello")
check(response.exitCode == 0)
check(response.output == "hello\n")
}Pair with a new Android 11+ device:
Kadb.pair("10.0.0.175", 37755, "643102")Discover wireless debugging endpoints with the optional mDNS artifact:
val mdns = KadbMdnsAndroid(context)
mdns.start()val mdns = KadbMdnsJvm()
mdns.start()Discovered endpoints can be passed to Kadb.create(host, port) or Kadb.pair(host, port, code).
| Capability | API |
|---|---|
Connect to adbd over TCP |
Kadb.create(...) |
| USB discovery / connection | Platform-specific KadbUsb.devices(...), KadbUsb.create(...)
|
| Wireless pairing | Kadb.pair(...) |
| Shell |
shell(...), openShell(), openPtyShellSession()
|
| File transfer |
push(...), pull(...), openSync()
|
| APK install |
install(...), installMultiple(...), uninstall(...)
|
| Port forwarding | tcpForward(...) |
| Transport reuse | resetConnection() |
| Optional mDNS discovery |
KadbMdnsAndroid, KadbMdnsJvm
|
Install an APK:
Kadb.create("127.0.0.1", 5555).use { kadb ->
kadb.install(apkFile)
}Push a file:
Kadb.create("127.0.0.1", 5555).use { kadb ->
kadb.push(localFile, "/data/local/tmp/remote.txt")
}Forward a TCP port:
Kadb.create("127.0.0.1", 5555).tcpForward(
hostPort = 7001,
targetPort = 7001
).use {
// localhost:7001 now forwards to the device's port 7001
}minSdk 23
adb binaryconscrypt-openjdk-uber
Example JVM pairing dependency:
dependencies {
implementation("com.flyfishxu:kadb:2.1.5")
implementation("org.conscrypt:conscrypt-openjdk-uber:2.5.2")
}