Take ui-trace to the adb beside it
ui-trace found adb on PATH, and this machine's ambient PATH puts the SDK's own platform-tools ahead of ~/.local/bin -- so unless a project's android-env.sh had been sourced into that same shell, ui-trace drove the device through the unwrapped adb and failed with "more than one device" as soon as a second emulator was up. The wrapper installed beside it is the one that knows which emulator this checkout means, so it is now the first candidate rather than a coincidence of PATH order. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
e379edfc1b
commit
fe97956632
2 files changed
+18
-1
No files matched your search
@@ -0,0 +1,5 @@
|
|||||||
|
# Built by share/ui-trace/build.sh when the source is newer, and pushed to
|
||||||
|
# the device by ui-trace. Rebuilt on demand, so it is not worth committing --
|
||||||
|
# and a jar committed here would go stale against UiTrace.java without saying
|
||||||
|
# so.
|
||||||
|
share/ui-trace/uitrace.jar
|
||||||
+13
-1
@@ -37,7 +37,19 @@ DEVICE_JAR = "/data/local/tmp/uitrace.jar"
|
|||||||
|
|
||||||
|
|
||||||
def find_adb():
|
def find_adb():
|
||||||
"""The real adb, without assuming PATH has been set up for Android."""
|
"""The adb to drive the device with, without assuming anything about PATH.
|
||||||
|
|
||||||
|
The one installed beside this script comes first, and that is the point
|
||||||
|
rather than a convenience: it is the wrapper that fills in `-s` from the
|
||||||
|
checkout you are standing in, and without it a machine with two emulators
|
||||||
|
attached answers `failed to get feature set: more than one device`. PATH
|
||||||
|
order cannot be relied on for that -- the SDK's own platform-tools sits
|
||||||
|
ahead of ~/.local/bin in this machine's ambient PATH, and only a project's
|
||||||
|
android-env.sh puts it back.
|
||||||
|
"""
|
||||||
|
sibling = Path(__file__).resolve().parent / "adb"
|
||||||
|
if sibling.is_file() and os.access(sibling, os.X_OK):
|
||||||
|
return str(sibling)
|
||||||
for candidate in [
|
for candidate in [
|
||||||
os.environ.get("ADB"),
|
os.environ.get("ADB"),
|
||||||
"adb",
|
"adb",
|
||||||
|
|||||||
Reference in new issue
Block a user