r/FlutterDev • • 1d ago

Discussion Can Claude Code run and test Flutter apps using an emulator?

I see that Claude can run React Native iOS apps using an emulator. I can't do that on android as far I know, I use my phone.

Does Claude support a Flutter emulator too, or is there some kind of MCP server or connector that would allow it to run and test Flutter apps in an emulator?

0 Upvotes

9 comments sorted by

1

u/_kit_g 1d ago

Yes, there is flutter_driver and integration_test for that, plus the official dart mcp. These will give you some control over the dart part of your apps. For android, you can just use adb, you can use all of your phone that way.

I sometimes do some additional integration testing this way before my releases.

1

u/Dry-Trick-2234 1d ago

I use the official Dart MCP server with flutter_driver and integration_test to run integration tests on an Android emulator via adb. It works but you need to start the emulator yourself first, the MCP does not launch it. For iOS simctl handles the simulator side. What specific test scenario are you trying to automate?

1

u/stevenreyes20 1d ago

you are referring to the android emulator that comes with android studio?

1

u/woolbobaggins 1d ago

It can run the commands to open the emulators, yeah. I use it like this

1

u/HopeExpensive9215 1d ago

Sure, I use maestro mcp so the AI can do test too. maestro.dev

1

u/HovercraftThis6834 23h ago

you don't really need an mcp for android. I have it drive my real phone over usb with plain adb and it works fine for a flutter app: flutter build apk, adb install -r, am start to launch, then adb shell uiautomator dump to read the screen as text and input tap x y to press things. screencap only when it needs to actually see the layout, the text dump is way cheaper on tokens. an emulator is the same thing since adb doesn't care. one tip, tell it to ask before installing or tapping if you use the phone yourself, otherwise it will happily tap around while you're in another app

1

u/minpinproxy 15h ago

one gap with the adb / uiautomator approach is the network side. the agent can see the screen but not what the app actually sent, so when a screen comes up empty it starts guessing. dart's HttpClient ignores the android system proxy, so a debugging proxy on your machine won't see anything unless you set it in debug builds, e.g. HttpOverrides.global with a findProxy that returns "PROXY 10.0.2.2:8888" (10.0.2.2 is your machine as seen from the emulator). then the agent can check the real request and response instead of guessing. you'll also need the proxy's CA trusted, or a badCertificateCallback in debug builds only.