ddc7fb44b0
Chasing the video on the emulator found one lever that actually attacks the failure, and it is worth writing down even though it did not hold: emulator -avd phone ... -qemu -icount shift=1,sleep=off Without -icount the guest clock is tied to the host's wall clock, so Android's five-second startForegroundService() deadline means five real seconds however slowly TCG executes - which is what kills the app here every time. With -icount the guest clock advances per executed instruction, and it measured 2.30x slow (30.9 s host to 13.4 s guest uptime). On that boot a scan start succeeded: the app's notification appeared five seconds after the tap and there was no am_crash, the only success recorded on this machine. It then stopped reproducing - later attempts produced neither a notification nor a crash. Two possibilities, and the second is an app-side diagnosability gap: either the tap never reached the app, or ScanService.start() swallowed a ForegroundServiceStartNotAllowedException, which it does silently (it catches IllegalStateException and does nothing with it, so logcat shows nothing at all). Notes say so, and point at SETTLE_SECONDS / WARM_SECONDS for scaling the waits, because a dilated guest is slower at everything - uiautomator dumps included. The script also retries a tap (up to three times, re-reading the coordinates) before falling back to a cold restart, since on a slow emulator the window can still be settling while the accessibility tree already lists the button - and a restart costs another cold start. The recommendation stands: record the take on the phone.