android-verify-on-devicelisted
Install: claude install-skill damson/hard-won-skills
# Verify a change on a device
Driving an emulator is slow and every step of it can lie. A tap can miss and be
silently absorbed by the app; a capture can be of the previous screen, of a
transition, or of a splash frame that has not been replaced yet. **Each of those
reads as "the change did not work".** The cost of getting it wrong is not a failed
check, it is a real fix reported as broken and then "fixed" again.
So never act on a capture without knowing which activity was resumed and that the
frame changed since the action.
## Procedure
1. **Install the build you mean to test.** `./gradlew :<module>:installDebug` —
the app module under test, not necessarily `:app` — after the change compiles. Where the state under test is stored, `adb uninstall` first —
a preference left by an earlier run is the most common false result.
2. **Launch and wait for a real frame**, not for the command to return:
```bash
adb shell am force-stop <pkg>
adb logcat -c # BEFORE the launch, or see below
adb shell monkey -p <pkg> 1 >/dev/null 2>&1
until adb logcat -d | grep -q "Displayed <pkg>/.*MainActivity"; do sleep 1; done
```
**Clear the buffer first, or the wait is not a wait.** `logcat -d` dumps the
whole ring buffer, so the `Displayed` line from a launch ten minutes ago matches
on the first pass and the loop returns before this launch has drawn anything —
green, instant, and wrong. If the buffer cannot be cleared, match on a line