Skip to content

Allow flutter attach to discover flutter engine running on Custom Device #170635

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

dannyvalentesonos
Copy link
Contributor

Summary

A Custom Device's log reader doesn't do anything, and thus flutter attach will fail to ever find the flutter engine's VM service.

This change adds a new readLogs command to the CustomDeviceConfig, and which allows a custom device to read the logs from the running flutter app on the actual custom device, and then allow flutter attach to work.

Fixes #170634

Testing

Created a custom device, and added the following readLogs command in the custom_devices.json file:

"readLogs": [
        "sshpass",
        "-f",
        "/home/dvalente/player.txt",
        "ssh",
        "[email protected]",
        "tail -Fn +1 /opt/log/flutter.log"
      ]

Then, running flutter attach works every time.

Tested the following scenarios:

  • Launched flutter attach before app is running on device, and once app runs, flutter attach succeeds
  • Launched flutter attach after app is already running on device, and flutter attach succeeds.
  • Used flutter attach in Android Studio, and hot reload works just like any Android device.

A Custom Device's log reader doesn't do anything, and thus `flutter
attach` will fail to ever find the flutter engine's VM service.

This change adds a new `readLogs` command to the CustomDeviceConfig, and
which allows a custom device to read the logs from the running flutter
app on the actual custom device, and then allow flutter attach to work.
@flutter-dashboard
Copy link

It looks like this pull request may not have tests. Please make sure to add tests or get an explicit test exemption before merging.

If you are not sure if you need tests, consider this rule of thumb: the purpose of a test is to make sure someone doesn't accidentally revert the fix. Ask yourself, is there anything in your PR that you feel it is important we not accidentally revert back to how it was before your fix?

Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing.If you believe this PR qualifies for a test exemption, contact "@test-exemption-reviewer" in the #hackers channel in Discord (don't just cc them here, they won't see it!). The test exemption team is a small volunteer group, so all reviewers should feel empowered to ask for tests, without delegating that responsibility entirely to the test exemption group.

@github-actions github-actions bot added the tool Affects the "flutter" command-line tool. See also t: labels. label Jun 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
tool Affects the "flutter" command-line tool. See also t: labels.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Flutter attach never finds the running app on a custom device
1 participant