Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Wirelessly paired iPhone launches app, stuck at Dart VM Service discovery and does not attach #144634

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
hellohuanlin opened this issue Mar 5, 2024 · 17 comments
Labels
P3 Issues that are less important to the Flutter project platform-ios iOS applications specifically team-ios Owned by iOS platform team tool Affects the "flutter" command-line tool. See also t: labels. triaged-ios Triaged by iOS platform team

Comments

@hellohuanlin
Copy link
Contributor

hellohuanlin commented Mar 5, 2024

Steps to reproduce

When I run device lab test:

../../bin/dart bin/run.dart -d 00008030-001A083911C3802E --ab=2 --local-engine=ios_profile_unopt --local-engine-host host_profile_unopt -t platform_views_scroll_perf_ad_banners__timeline_summary

My phone shows a white screen and gets stuck. It looks like it's waiting for "Dart VM Service".

I have clicked this "Allow". Also tried uninstalling and reinstalling.

This didn't happen last week, with exactly the same code.

Expected results

NA

Actual results

NA

Code sample

[2024-03-05 11:26:42.539065] [STDOUT] stdout:            2024-03-05 11:26:42.277 xcodebuild[33190:2944419] Requested but did not find extension point with identifier Xcode.InterfaceBuilderBuildSupport.PlatformDefinition
[2024-03-05 11:26:42.551960] [STDOUT] stdout: [  +52 ms] executing: /usr/bin/xcode-select --print-path
[2024-03-05 11:26:42.558253] [STDOUT] stdout: [   +6 ms] Exit code 0 from: /usr/bin/xcode-select --print-path
[2024-03-05 11:26:42.558270] [STDOUT] stdout: [        ] /Applications/Xcode.app/Contents/Developer
[2024-03-05 11:26:42.558459] [STDOUT] stdout: [        ] executing: /usr/bin/arch -arm64e xcrun osascript -l JavaScript /Users/huanlin/Desktop/flutter/flutter/packages/flutter_tools/bin/xcode_debug.js check-workspace-opened --xcode-path /Applications/Xcode.app --project-path /Users/huanlin/Desktop/flutter/flutter/dev/benchmarks/platform_views_layout/ios/Runner.xcodeproj --workspace-path /Users/huanlin/Desktop/flutter/flutter/dev/benchmarks/platform_views_layout/ios/Runner.xcworkspace --verbose
[2024-03-05 11:26:42.645908] [STDOUT] stdout: [  +87 ms] {"status":false,"errorMessage":"Xcode is not running","debugResult":null}
[2024-03-05 11:26:42.645933] [STDOUT] stdout: 
[2024-03-05 11:26:42.645938] [STDOUT] stdout:            {"command":"check-workspace-opened","xcodePath":"/Applications/Xcode.app","projectPath":"/Users/huanlin/Desktop/flutter/flutter/dev/benchmarks/platform_views_layout/ios/Runner.xcodeproj","projectName":null,"expectedConfigurationBuildDir":null,"workspacePath":"/Users/huanlin/Desktop/flutter/flutter/dev/benchmarks/platform_views_layout/ios/Runner.xcworkspace","targetDestinationId":null,"targetSchemeName":null,"skipBuilding":null,"launchArguments":null,"closeWindowOnStop":null,"promptToSaveBeforeClose":null,"verbose":true}
[2024-03-05 11:26:42.646373] [STDOUT] stdout: [        ] Error checking if project opened in Xcode: Xcode is not running
[2024-03-05 11:26:42.646518] [STDOUT] stdout: [        ] executing: open -a /Applications/Xcode.app -g -j -F /Users/huanlin/Desktop/flutter/flutter/dev/benchmarks/platform_views_layout/ios/Runner.xcworkspace
[2024-03-05 11:26:42.729353] [STDOUT] stdout: [  +82 ms] executing: /usr/bin/arch -arm64e xcrun osascript -l JavaScript /Users/huanlin/Desktop/flutter/flutter/packages/flutter_tools/bin/xcode_debug.js debug --xcode-path /Applications/Xcode.app --project-path /Users/huanlin/Desktop/flutter/flutter/dev/benchmarks/platform_views_layout/ios/Runner.xcodeproj --workspace-path /Users/huanlin/Desktop/flutter/flutter/dev/benchmarks/platform_views_layout/ios/Runner.xcworkspace --project-name Runner --expected-configuration-build-dir /Users/huanlin/Desktop/flutter/flutter/dev/benchmarks/platform_views_layout/build/ios/iphoneos --device-id 00008030-001A083911C3802E --scheme Runner --skip-building --launch-args ["--enable-dart-profiling","--start-paused","--verbose-logging","--enable-impeller=true","--vm-service-host=0.0.0.0"] --verbose
[2024-03-05 11:26:42.770374] [STDOUT] stdout: [  +40 ms] stderr: {"command":"debug","xcodePath":"/Applications/Xcode.app","projectPath":"/Users/huanlin/Desktop/flutter/flutter/dev/benchmarks/platform_views_layout/ios/Runner.xcodeproj","projectName":"Runner","expectedConfigurationBuildDir":"/Users/huanlin/Desktop/flutter/flutter/dev/benchmarks/platform_views_layout/build/ios/iphoneos","workspacePath":"/Users/huanlin/Desktop/flutter/flutter/dev/benchmarks/platform_views_layout/ios/Runner.xcworkspace","targetDestinationId":"00008030-001A083911C3802E","targetSchemeName":"Runner","skipBuilding":true,"launchArguments":["--enable-dart-profiling","--start-paused","--verbose-logging","--enable-impeller=true","--vm-service-host=0.0.0.0"],"closeWindowOnStop":null,"promptToSaveBeforeClose":null,"verbose":true}
[2024-03-05 11:26:45.881182] [STDOUT] stdout: [+3110 ms] stderr: Workspace: /Users/huanlin/Desktop/flutter/flutter/dev/benchmarks/platform_views_layout/ios/Runner.xcworkspace
[2024-03-05 11:26:47.071875] [STDOUT] stdout: [+1190 ms] stderr: Device: My Mac (00006002-0014504C11FBC01E)
[2024-03-05 11:26:47.187233] [STDOUT] stdout: [ +115 ms] stderr: Device: Huan’s iPhone 13 Mini (00008110-00023DDC1A84801E)
[2024-03-05 11:26:47.317621] [STDOUT] stdout: [ +129 ms] stderr: Device: iPad (00008103-000D25610E33001E)
[2024-03-05 11:26:47.426878] [STDOUT] stdout: [ +109 ms] stderr: Device: iPhone 11 (00008030-001A083911C3802E)
[2024-03-05 11:26:48.795289] [STDOUT] stdout: [+1368 ms] stderr: CONFIGURATION_BUILD_DIR: /Users/huanlin/Desktop/flutter/flutter/dev/benchmarks/platform_views_layout/build/ios/iphoneos
[2024-03-05 11:26:48.836169] [STDOUT] stdout: [  +40 ms] stderr: Action result status: not yet started
[2024-03-05 11:26:49.354369] [STDOUT] stdout: [ +517 ms] {"status":true,"errorMessage":null,"debugResult":{"completed":false,"status":"running","errorMessage":null}}
[2024-03-05 11:26:49.357745] [STDOUT] stdout: [   +4 ms] Application launched on the device. Waiting for Dart VM Service url.
[2024-03-05 11:26:49.366759] [STDOUT] stdout: [   +7 ms] Checking for advertised Dart VM Services...
[2024-03-05 11:28:04.364272] [STDOUT] stderr: [+74997 ms] The Dart VM Service was not discovered after 75 seconds. This is taking much longer than expected...
[2024-03-05 11:28:04.364376] [STDOUT] stderr: [        ] Open the Xcode window the project is opened in to ensure the app is running. If the app is not running, try selecting "Product > Run" to fix the problem.
[2024-03-05 11:28:04.364390] [STDOUT] stderr: [        ] 
[2024-03-05 11:28:04.364403] [STDOUT] stderr:            Click "Allow" to the prompt asking if you would like to find and connect devices on your local network. This is required for wireless debugging. If you selected "Don't Allow", you can turn it on in Settings > Your App Name > Local Network. If you don't see your app in the Settings, uninstall the app and rerun to see the prompt again.

Screenshots or Video

Screenshots / Video demonstration

[Upload media here]

Logs

Logs
[Paste your logs here]

Flutter Doctor output

Doctor output
[Paste your output here]
@hellohuanlin hellohuanlin added platform-ios iOS applications specifically infra: device lab Infrastructure device lab problems labels Mar 5, 2024
@vashworth
Copy link
Contributor

@hellohuanlin Is the Dart VM url visible in the Xcode console?

@danagbemava-nc danagbemava-nc added the team-infra Owned by Infrastructure team label Mar 6, 2024
@Hiraokii
Copy link

Hiraokii commented Mar 6, 2024

If the app starts with the blank screen, you need to run into console flutter attach then open the dev tools using the url provided after the attach and then resume the app.

@hellohuanlin
Copy link
Contributor Author

I suspect that this is related to wireless debugging. Just passed the test after wiring up.

@jmagman jmagman added team-ios Owned by iOS platform team and removed team-infra Owned by Infrastructure team labels Mar 6, 2024
@LouiseHsu LouiseHsu added the triaged-ios Triaged by iOS platform team label Mar 6, 2024
@LouiseHsu LouiseHsu added the P2 Important issues not at the top of the work list label Mar 6, 2024
@Hiraokii
Copy link

Hiraokii commented Mar 6, 2024

I suspect that this is related to wireless debugging. Just passed the test after wiring up.

this is happening with the Xcode 15 and iOS 17 to me, but the way that I fixes was that way. have u tried?

@jmagman jmagman changed the title [device_lab][ios]device lab stuck at Dart VM Service discovery Wirelessly paired iPhone launches app, stuck at Dart VM Service discovery and does not attach Mar 6, 2024
@jmagman jmagman removed the infra: device lab Infrastructure device lab problems label Mar 6, 2024
@Hiraokii
Copy link

Hiraokii commented Mar 6, 2024

after your app starts with the blank screen try flutter attach
Screenshot 2024-03-07 at 7 46 06
then
Screenshot 2024-03-07 at 7 46 24
it will work

@hellohuanlin
Copy link
Contributor Author

@Hiraokii thanks for your input! This will be run on flutter CI, so manual operations in Xcode won't solve it.

@jmagman jmagman added the tool Affects the "flutter" command-line tool. See also t: labels. label Mar 7, 2024
@vashworth
Copy link
Contributor

vashworth commented Mar 11, 2024

@hellohuanlin Looks like test platform_views_scroll_perf_ad_banners__timeline_summary isn't on master yet? It's hard for me to debug what's going on without a full log.

It's could be that port publication is disabled, since we disable it for perf tests in CI (#136562), which would cause wireless debugging to not work.

@hellohuanlin hellohuanlin removed their assignment Apr 10, 2024
@hellohuanlin hellohuanlin added P3 Issues that are less important to the Flutter project and removed P2 Important issues not at the top of the work list labels Apr 10, 2024
@hellohuanlin
Copy link
Contributor Author

@jmagman downgraded to P3. I think I will just keep my phone always plugged. Not too important.

@bawantha

This comment was marked as duplicate.

@AlexV525
Copy link
Member

AlexV525 commented Oct 31, 2024

Sometimes the debugging session will run into wireless even if you've plugged the cable. A most edged case is if the user is denied access to connected devices then they won't realize because the device is shown in the list.

(EDIT: Another case is really really dumb, which I just did. I plugged my phone into my hub but didn't plug the hub's cable into my computer. So the phone is charging but not connected to the computer 😆)

There are some approaches that I would suggest:

  1. We should definitely find a solution to avoid hanging when debugging the Flutter app wirelessly.
  2. We can add more words to that notice when the Dart VM Services connection is timeout, maybe: If you are debugging the device wirelessly, plug in the cable and allow it to connect.
  3. Detect if a device is wirelessly connected and add to the device name list: Launching lib/main.dart on Alex iPhone (wireless) in debug mode...

IMO all of them can help users to realize the issue without struggling.

(EDIT: The second approach should be easy to implement and I'd like to go for it if anyone agrees with)

@WhiteKr
Copy link

WhiteKr commented Dec 18, 2024

It's quite a huge inconvenience to wire my phone up every time I start development. It's on a MagSafe charger and connected to a charging cable simultaneously. Could you explain the reason for this issue? Many people including myself would greatly appreciate this feature for a better experience. It's on 3rd priority, which is sad.

github-merge-queue bot pushed a commit that referenced this issue Jan 10, 2025
…0497)

An improvement for #144634.

A wirelessly connected device will displayed as `Target device 1
(wireless)` in various of places.

## Pre-launch Checklist

- [x] I read the [Contributor Guide] and followed the process outlined
there for submitting PRs.
- [x] I read the [Tree Hygiene] wiki page, which explains my
responsibilities.
- [x] I read and followed the [Flutter Style Guide], including [Features
we expect every widget to implement].
- [x] I signed the [CLA].
- [x] I listed at least one issue that this PR fixes in the description
above.
- [x] I updated/added relevant documentation (doc comments with `///`).
- [x] I added new tests to check the change I am making, or this PR is
[test-exempt].
- [x] I followed the [breaking change policy] and added [Data Driven
Fixes] where supported.
- [x] All existing and new tests are passing.

If you need help, consider asking for advice on the #hackers-new channel
on [Discord].

<!-- Links -->
[Contributor Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview
[Tree Hygiene]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md
[test-exempt]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests
[Flutter Style Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md
[Features we expect every widget to implement]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement
[CLA]: https://cla.developers.google.com/
[flutter/tests]: https://github.com/flutter/tests
[breaking change policy]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes
[Discord]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md
[Data Driven Fixes]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md
@AlexV525
Copy link
Member

  1. We can add more words to that notice when the Dart VM Services connection is timeout, maybe: If you are debugging the device wirelessly, plug in the cable and allow it to connect.
  2. Detect if a device is wirelessly connected and add to the device name list: Launching lib/main.dart on Alex iPhone (wireless) in debug mode...

These two improvements are landed in #160497.

maheshj01 pushed a commit to maheshj01/flutter that referenced this issue Jan 15, 2025
…tter#160497)

An improvement for flutter#144634.

A wirelessly connected device will displayed as `Target device 1
(wireless)` in various of places.

## Pre-launch Checklist

- [x] I read the [Contributor Guide] and followed the process outlined
there for submitting PRs.
- [x] I read the [Tree Hygiene] wiki page, which explains my
responsibilities.
- [x] I read and followed the [Flutter Style Guide], including [Features
we expect every widget to implement].
- [x] I signed the [CLA].
- [x] I listed at least one issue that this PR fixes in the description
above.
- [x] I updated/added relevant documentation (doc comments with `///`).
- [x] I added new tests to check the change I am making, or this PR is
[test-exempt].
- [x] I followed the [breaking change policy] and added [Data Driven
Fixes] where supported.
- [x] All existing and new tests are passing.

If you need help, consider asking for advice on the #hackers-new channel
on [Discord].

<!-- Links -->
[Contributor Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview
[Tree Hygiene]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md
[test-exempt]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests
[Flutter Style Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md
[Features we expect every widget to implement]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement
[CLA]: https://cla.developers.google.com/
[flutter/tests]: https://github.com/flutter/tests
[breaking change policy]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes
[Discord]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md
[Data Driven Fixes]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md
@nick4fake
Copy link

nick4fake commented Apr 11, 2025

Is wireless launch/debug something that is not supported yet? After many retries and checking all the solutions it still doesn't work for me

@vashworth
Copy link
Contributor

vashworth commented Apr 11, 2025

Wireless debugging should work without plugging in your phone. For those of you having issues, please answer the following questions:

  1. What iOS version is the device?
  2. What Xcode version?
  3. Are both the iOS device and the mac on the same local network?
  4. If you open Xcode and open Window > Devices and Simulators, does the device show in the window? Does it show a little network icon beside the name? Does it show any warnings/errors when clicked on?
  5. If you receive a timeout warning, run dns-sd -B _dartVmService._tcp in a separate terminal (while flutter is still searching), does it return anything?

@samtuga1-mova

This comment has been minimized.

@Peeeaje
Copy link

Peeeaje commented May 1, 2025

@vashworth
I have the problem in wireless debugging. (Can launch app but it doesn't find dart vm)
With the cable plugged in it runs correctly.

18.1.1

What iOS version is the device?

16.2

What Xcode version?

Yes

Are both the iOS device and the mac on the same local network?

It appears in the list and shows network icon. I clicked the icon but nothing happened.

If you open Xcode and open Window > Devices and Simulators, does the device show in the window? Does it show a little network icon beside the name? Does it show any warnings/errors when clicked on?

$ flutter run -d {device-id}
Launching lib/main.dart on Dev iPhone (wireless) in debug mode...
Automatically signing iOS for device deployment using specified development team in Xcode project: {project-code}
Running Xcode build...
 └─Compiling, linking and signing...                         6.4s
Xcode build done.                                           25.0s
You may be prompted to give access to control Xcode. Flutter uses Xcode to run your app. If access is not allowed, you
can change this through your Settings > Privacy & Security > Automation.
The Dart VM Service was not discovered after 75 seconds. This is taking much longer than expected...
Open the Xcode window the project is opened in to ensure the app is running. If the app is not running, try selecting
"Product > Run" to fix the problem.

Your debugging device seems wirelessly connected. Consider plugging it in and trying again.

Click "Allow" to the prompt asking if you would like to find and connect devices on your local network. This is
required for wireless debugging. If you selected "Don't Allow", you can turn it on in Settings > Your App Name > Local
Network. If you don't see your app in the Settings, uninstall the app and rerun to see the prompt again.
Installing and launching...                                            ⣽
$ dns-sd -B _dartVmService._tcp
Browsing for _dartVmService._tcp
DATE: ---Thu 01 May 2025---
13:50:05.819  ...STARTING...

If you receive a timeout warning, run dns-sd -B _dartVmService._tcp in a separate terminal (while flutter is still searching), does it return anything?

@Peeeaje
Copy link

Peeeaje commented May 1, 2025

I upgraded to 18.4.1 but it didn't help but dns-sd's output changed.

$ dns-sd -B _dartVmService._tcp
Browsing for _dartVmService._tcp
DATE: ---Thu 01 May 2025---
14:08:54.984  ...STARTING...
Timestamp     A/R    Flags  if Domain               Service Type         Instance Name
14:08:55.145  Add        2  16 local.               _dartVmService._tcp. {my-instance-name}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P3 Issues that are less important to the Flutter project platform-ios iOS applications specifically team-ios Owned by iOS platform team tool Affects the "flutter" command-line tool. See also t: labels. triaged-ios Triaged by iOS platform team
Projects
Status: Ready
Development

No branches or pull requests