Repository navigation
Teach flutter_tools how to use mDNS to find the iOS observatory port #23164
Description
Activity
- addedplatform-iosiOS applications specificallyiOS applications specificallytoolAffects the "flutter" command-line tool. See also t: labels.Affects the "flutter" command-line tool. See also t: labels.platform-macosBuilding on or for macOS specificallyBuilding on or for macOS specificallydependency: dartDart team may need to help usDart team may need to help us
on Oct 16, 2018 Once flutter/packages#7 lands, we should be able to consume it in
flutter_tools. From there it should be pretty straightforward.Moving to bucket12 due to code freeze.
This will require some changes upstream in Dart - I'm working on those, but it will take into January to get to it.
Is this iOS-only, or will it help Android? If Android, will it remove the reliance on
logcatentirely? #25455 shows a device wherelogcatjust stops streaming anything towards the end of boot, which means Flutter is never able to get the VM port (and I'm out of ideas for debugging!).@DanTup Android should be able to utilize ADB directly via Intents which is much simpler than this iOS solution. I've been waiting for the iOS side to finish before worrying about Android because the Android path seems highly confident, whereas the iOS approach has changed a number of times and is still in flux.
1 remaining item
This is waiting for Dart to catch up in google3. Updating milestone to March.
I believe this landed, closing!
My bad!
The mDNS query for an attached iOS device failed. It may be necessary to disable the "Personal Hotspot" on the device, and to ensure that the "Disable unless needed" setting is unchecked under System Preferences > Network > iPhone USB. See #46698 for details.
Waiting for a connection from Flutter on iPhone 11 Pro Max...I use simulator always get this message,what's wrong?
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of
flutter doctor -vand a minimal reproduction of the issue.- locked as resolved and limited conversation to collaborators
on Aug 21, 2021
flutter-team-archive/engine#6533 added the ability to have iOS apps advertise the Dart observatory port over mDNS. The following command on macOS can display that information:
which has output similar to the following:
indicating the observatory port is running on 49198 from the
SRVrecord. Runningflutter attach --debug-port 49198will successfully attach to that observatory port.Unfortunately,
dns-sdis not suitable for scripting (it never "finishes" processing, the output and command flags are explicitly not guaranteed), and we'd like to avoid adding more Ruby/Python/etc. scripts to support this.Writing the mDNS query in Dart (particularly on macOS) is currently blocked by dart-lang/sdk#34799. A patch has been created, and using that source I've been able to successfully query the service using Dart on macOS.
Once that lands, we should be able to either implement mDNS in the Dart SDK (e.g. in
dart:io), or at least have a simple client in theflutter_toolspackage that can discover the port automatically forflutter attachwithout any additional steps./cc @matthew-carroll @tvolkert @cbracken