feat(folio): ask which android device to run on when none is named

This commit is contained in:
pj committed 2026-09-05 16:40:27 +05:30
1 parent 8c31e2bf6f
commit 419ed9d1c0
2 files changed
+116 -27

No files matched your search

+15 -8
View File
@@ -23,15 +23,17 @@ example sanderling runs its property-based specs against.
## Android
```sh
just install # asks which device, then builds + installs
ANDROID_DEVICE=emulator-5554 just install # build + install on that device
ANDROID_DEVICE=emulator-5554 just uninstall
just clean
```
`ANDROID_DEVICE` is the serial `adb devices` reports. Every recipe that
installs, uninstalls or fuzzes refuses to run without it, unless the only
device adb can see is a single emulator on the local adb server. The refusal
prints what adb currently sees.
installs, uninstalls or fuzzes acts on that serial. Without it they print the
online devices and ask which one to use, and pick on their own only when the
one device adb can see is an emulator on the local adb server. With no terminal
to ask on, a CI job say, the ask becomes a refusal that prints what adb sees.
A run installs the app, clears its state and drives it, which is not something
to do to a handset that happens to be the one thing plugged in. An emulator is
@@ -73,9 +75,9 @@ password: ledger123
ANDROID_DEVICE=emulator-5554 just test
```
The same naming rule as `just install` applies. If nothing is attached at all,
`just test` boots a bootable AVD and runs against that. With multiple AVDs,
pick one:
The same naming rule as `just install` applies, and `just test` asks once for
the whole run. If nothing is attached at all, `just test` boots a bootable AVD
and runs against that. With multiple AVDs, pick one:
```sh
AVD=Pixel_7 just test
@@ -90,14 +92,19 @@ DURATION=5m
The device does not have to be attached to this machine. `ADB_SERVER_SOCKET`
aims adb at another host's adb server, and `ANDROID_DEVICE` names the serial
that server reports. A remote server is shared, so `ANDROID_DEVICE` is required
there even when it holds only one device:
that server reports. A remote server is shared, so nothing there is ever picked
without being named or asked about, one device on it or twenty:
```
ADB_SERVER_SOCKET=tcp:10.0.0.5:5037
ANDROID_DEVICE=emulator-5556
```
The older `ANDROID_ADB_SERVER_ADDRESS` / `ANDROID_ADB_SERVER_PORT` pair works
too, at the same precedence the adb CLI gives it. A remote server is never
auto-booted against: when it reports no device, `just test` says so rather than
starting a local emulator that server will never see.
Gradle only assembles the APK. The install goes through adb, which reads those
variables, so a remote server needs nothing else. Gradle's own `installDebug`
cannot be used here: its adb client only ever dials loopback.