mobile-dev-inc / dadb

A Kotlin/Java library to connect directly to an Android device without an adb binary or an ADB server
Apache License 2.0
1.02k stars 72 forks source link

Dadb.list throws IOException on unauthorized device (OFFLINE)? #55

Open mrenouf opened 1 year ago

mrenouf commented 1 year ago
Exception in thread "main" java.io.IOException: Command failed (host:transport:131xxxxxxx19J): device unauthorized.
This adb server's $ADB_VENDOR_KEYS is not set
Try 'adb kill-server' if that seems wrong.
Otherwise check for a confirmation dialog on your device.
    at dadb.adbserver.AdbServer.send$dadb(AdbServer.kt:99)
    at dadb.adbserver.AdbServerDadb.open(AdbServer.kt:137)
    at dadb.adbserver.AdbServerDadb.<init>(AdbServer.kt:128)
    at dadb.adbserver.AdbServer.createDadb(AdbServer.kt:52)
    at dadb.adbserver.AdbServer.listDadbs(AdbServer.kt:81)
    at dadb.adbserver.AdbServer.listDadbs$default(AdbServer.kt:60)
    at dadb.Dadb$Companion.list(Dadb.kt:244)
    at dadb.Dadb$Companion.list$default(Dadb.kt:243)
    at LogcatKt.list(Logcat.kt:36)
flyfishxu commented 1 year ago

When you first connect your target device, you must authorize your phone. Usually, a dialog will show on your target device, you need to click "Allow", then you will have permission to control your target device by ADB.