diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..204cab6 --- /dev/null +++ b/.gitignore @@ -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 diff --git a/bin/ui-trace b/bin/ui-trace index 3a59415..bebdb03 100755 --- a/bin/ui-trace +++ b/bin/ui-trace @@ -37,7 +37,19 @@ DEVICE_JAR = "/data/local/tmp/uitrace.jar" 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 [ os.environ.get("ADB"), "adb",