Repository navigation
feat(dart): Flutter on an Android emulator, measured end to end (#790, M3) - #883
Merged
Merged
Conversation
M3 of #790. `deviceId: "emulator-5554"` already reached `flutter run -d` through M1's wiring; this proves it through the server and pins it: - tests/e2e/mcp-server-smoke-flutter-android.test.ts: `flutter run` on the emulator with a breakpoint in build() (widget state, continue keeps it running, close terminates the app) and an integration_test on the emulator whose tap hits the app's breakpoint. Opt-in by booting an emulator; self-skips without Flutter, adb or an online emulator, and with MCP_SKIP_FLUTTER_ANDROID=1. Never runs on CI. - tests/e2e/dart-example-utils.ts: adb discovery, the online-emulator gate, prepareFlutterAndroid (flutter create --platforms=android, one debug APK build, adb install -r -t) and resetAndroidApp (force-stop + forward --remove-all before every launch). Measured: the first run after a fresh install once ended without a stop; the next was fine. - Docs: the guide's Android numbers (build() breakpoint ~21 s, integration_test ~28 s warm; a cold Gradle build is minutes and belongs to the first build), KNOWN_ISSUES (emulator attach does not connect, #882; stop the previous instance first), the spike notes' M3 table, the e2e README, the changelog fragment. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
…es not already do (#790) From the scoped review of #883: - `adb forward --remove-all` is host-wide (killforward-all drops every device's listeners), so it took other tools' forwards with it. The helper now removes only this emulator's entries from `adb forward --list`. - `flutter run` force-stops, builds and installs on every launch (android_device.dart startApp → stopApp, installApp), and `flutter build apk --debug` builds three ABIs while `flutter run` builds the device's, so the warm-up used to be replaced by the first launch. The prebuild now targets the device's ABI (ro.product.cpu.abi); the docstring, guide, KNOWN_ISSUES and spike notes say what it buys — a warm Gradle cache and the first install — instead of describing it as a fix, and the once-seen "ended without a stop" is labelled as seen once. - `adb` errors now carry stderr (install failures report their reason), and an incompatible installed APK is uninstalled once and retried, the way flutter_tools does. - adb discovery covers Android Studio's default SDK paths on macOS and Linux; the emulator gate consults Flutter's device list before starting an adb server. - Both Flutter suites wait for a stop in `wait_for_stop` slices of at most 45 s: the MCP client caps a request at 60 s, and one long server-side wait failed on the client side when a build kept the first stop away for 63 s (seen on the emulator's integration case). Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This was referenced Oct 9, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part of #790 — M3 of three (Android emulators and devices), the "pass the device to use" half of the request. M1 (#880) wired
deviceId→flutter run -d <id>; M2 (#881) proved desktop and tests; this proves the emulator through the server and pins it.What this adds
tests/e2e/mcp-server-smoke-flutter-android.test.ts— two cases measured throughdist/index.json Windows (Flutter 3.47.7, AVDmcp_api35booted headless, Gradle warm, the debug APK installed up front):flutter run -d emulator-5554, breakpoint inbuild():_ProbeAppState.build,counter→0,continuekeeps it running,close_debug_sessionterminates the appintegration_teston the emulator: the test's breakpoint, then the test's tap hits the app'sincrement()breakpoint,✓ device increment,stoppedendThe opt-in is a booted emulator (
flutter emulators --launch <id>); the suite self-skips without Flutter, adb or an online emulator, and withMCP_SKIP_FLUTTER_ANDROID=1. It never runs on CI.e2e helpers — adb discovery (
ANDROID_SDK_ROOT/ANDROID_HOME/PATH), the online-emulator gate (adb devicessaysdevice, andflutter deviceslists it),prepareFlutterAndroid(flutter create --platforms=android, oneflutter build apk --debug,adb install -r -t) andresetAndroidApp(am force-stop+adb forward --remove-allbefore every launch). Both steps come from measurements: the firstflutter runafter a fresh APK install once ended without a stop, and the spike saw a launch hang while a live instance was being replaced.Docs — the guide's Android section with the numbers and the recipe,
KNOWN_ISSUES(attaching to an app anotherflutter runstarted on the emulator does not connect, tracked in dart: attaching to an app another flutter run started on an Android emulator never connects (host-forwarded VM-service URI) #882; stop the previous instance first), the spike notes' M3 table, the e2e README, the changelog fragment.No adapter or core code changes.
Measured but deferred
flutter attach; desktop and Dart attach work. The--device-vmservice-port/--host-vmservice-port/--no-ddsvariants are the next measurements.deviceId= the serialflutter devicesprints) but were not measured — no device on this box.list_devices(feat(dart): list_devices for Flutter targets (flutter devices --machine, unbooted emulators) #877), web targets (listed, unexercised).With this merged, #790's three milestones are on
main; the announcement checklist is next.🤖 Generated with Claude Code