StartAdbInteractor with default values doesn't work on Windows
See original GitHub issueDescribe the bug
Running StartAdbInteractor().execute() never successfully starts an adb server on Windows, because the code explicitly searches for a file named adb in the Android home, but on Windows it’s called adb.exe.
To Reproduce
Simply run StartAdbInteractor().execute() (with default values) on Windows, the result is always false.
Expected behavior
It would be great that the default adb binary path was OS-dependent and was adb.exe on Windows instead of adb, so it would work as smoothly as on other OS’es.
An even simpler option would be to fallback to a ProcessBuilder with just adb as command name (not a full path), because on my machine adb is on the PATH, so the filename doesn’t matter.
Workaround
The following works fine:
val androidHome = System.getenv("ANDROID_HOME")?.ifBlank { null }
val adbBinary = androidHome?.let { Paths.get(androidHome, "platform-tools", "adb.exe")}
val adbServerStarted = StartAdbInteractor().execute(adbBinary = adbBinary?.toFile())
if (!adbServerStarted) {
error("No adb server running")
}
Android device (please complete the following information):
- Device: [e.g. Nexus 5] irrelevant
- OS: [e.g. Android 8.1 official] irrelevant
- Adam Version: 0.2.5
- Android Debug Server Version [e.g. 41]: Android Debug Bridge version 1.0.41, Version 31.0.2-7242960
Issue Analytics
- State:
- Created 2 years ago
- Comments:7 (5 by maintainers)

Top Related StackOverflow Question
@joffrey-bion released in 0.3.1
Since I don’t have an environment to verify this change I’ll await your reply. Thank you!