Repository navigation
Web device is not being detected when running VSCode from icon launcher #4778
Description
Describe the bug
Web device is not being detected when running VSCode from icon launcher but if it's run from terminal.
To Reproduce
Steps to reproduce the behavior:
- Run VSCode from its icon launcher which opens the latest Flutter project visited
- No Web device is detected

- If I run VSCode from terminal then my Web device is detected

Flutter detects Web device in both cases:
$ flutter devices
1 connected device:
Chrome (web) • chrome • web-javascript • Google Chrome 117.0.5938.149
This problem has emerged since the most recent VSCode and Flutter update .
More info
$ flutter doctor -v
[✓] Flutter (Channel stable, 3.13.6, on EndeavourOS 6.5.5-zen1-1-zen, locale en_US.UTF-8)
• Flutter version 3.13.6 on channel stable at /home/warcayac/Applications/flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision ead455963c (10 days ago), 2023-09-26 18:28:17 -0700
• Engine revision a794cf2681
• Dart version 3.1.3
• DevTools version 2.25.0
[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
• Android SDK at /home/warcayac/Android/Sdk
• Platform android-34, build-tools 34.0.0
• ANDROID_SDK_ROOT = /home/warcayac/Android/Sdk
• Java binary at: /opt/android-studio/jbr/bin/java
• Java version OpenJDK Runtime Environment (build 17.0.6+0-17.0.6b829.9-10027231)
• All Android licenses accepted.
[✓] Chrome - develop for the web
• CHROME_EXECUTABLE = /bin/google-chrome-stable
[✓] Android Studio (version 2022.3)
• Android Studio at /opt/android-studio
• Flutter plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/6351-dart
• Java version OpenJDK Runtime Environment (build 17.0.6+0-17.0.6b829.9-10027231)
[✓] Connected device (1 available)
• Chrome (web) • chrome • web-javascript • Google Chrome 117.0.5938.149
[✓] Network resources
• All expected network resources are available.
• No issues found!
I'm using the following setting (see this post)
{
"dart.env": {
"CHROME_EXECUTABLE": "/usr/bin/my-google-chrome"
}
}
I have similar environment variable in my .zshrc file.
Expected behavior
Either by icon launcher or from terminal the Web device should be available to select:
Screenshots
If applicable, add screenshots to help explain your problem.
Please complete the following information:
You can run the Dart: Collect Diagnostic Information command from the VS Code command palette (F1) to easily capture this information or provide it manually.
- Operating System and version:
OS: EndeavourOS Linux x86_64
Kernel: 6.5.5-zen1-1-zen
Shell: zsh 5.9
DE: Plasma 5.27.8
WM: KWin
- VS Code version:
Version: 1.83.0
Commit: e7e037083ff4455cf320e344325dacb480062c3c
Date: 2023-10-03T16:11:49.843Z
Electron: 25.8.4
ElectronBuildId: 24154031
Chromium: 114.0.5735.289
Node.js: 18.15.0
V8: 11.4.183.29-electron.0
OS: Linux x64 6.5.5-zen1-1-zen
- Dart extension version: v3.74.0
- Dart/Flutter SDK version:
Flutter 3.13.6 • channel stable • https://github.com/flutter/flutter.git
Framework • revision ead455963c (10 days ago) • 2023-09-26 18:28:17 -0700
Engine • revision a794cf2681
Tools • Dart 3.1.3 • DevTools 2.25.0
- Target device (if the issue relates to Flutter debugging):
Activity
DanTup commentedon Oct 6, 2023
Can you run the Flutter: Run Flutter Doctor command from the VS Code command palette (not from the built-in terminal) and post the output?
My feeling is that the
CHROME_EXECUTABLEindart.envis not working correctly, but I'm not sure why.warcayac commentedon Oct 6, 2023
This output (running Flutter: Run Flutter Doctor) is when VSCode is run from terminal:
This output (running Flutter: Run Flutter Doctor) is when VSCode is run from icon launcher:
warcayac commentedon Oct 6, 2023
According previous output, Flutter is no detecting binaries paths when launching from icon launcher. this didn't happen before
DanTup commentedon Oct 6, 2023
This is likely because of setting
PATHin a terminal script that doesn't apply to launching from the dock. This isn't an issue for the VS Code extension, although might affect Flutter if it relies on finding things fromPATH.Can you try enabling the Flutter Daemon log (https://dartcode.org/docs/logging/#flutter-daemon) using the
dart.flutterDaemonLogFilesetting?warcayac commentedon Oct 6, 2023
DanTup commentedon Oct 6, 2023
Looks like we're never getting any devices from the daemon. Can you try running:
in a terminal, and then paste the following in and press
<enter>:Then wait for 30 seconds, hit Crtl+C to terminate the process, and share the output here. My guess is that Flutter isn't discovering the web device but I'm not sure why (since
CHROME_EXECUTABLEdoes appear to be set correctly).warcayac commentedon Oct 6, 2023
DanTup commentedon Oct 8, 2023
Oh, that didn't help much - because the Chrome device is showing up when you run from the terminal.
Could you try enabling the log file again, but also passing "-v" to Flutter processes by using the following in your VS Code settings:
You can set the log path to anything. Then reload VS Code, trigger the issue, then grab a copy of the log file.
Remove the settings once you're done (because the last setting will cause Flutter to generate verbose output for all processes).
Thanks!
warcayac commentedon Oct 8, 2023
I added those settings then restarted VSC and tried run my app, this is the output:
DanTup commentedon Oct 9, 2023
Thanks! It looks like we're spawning the daemon without the
CHROME_EXECUTABLEvariable you set indart.env:I'll see if I can track down why that's being lost.
DanTup commentedon Oct 9, 2023
Apparently I broke this when implementing 41fc23b. Will push an update to the pre-release channel including the fix later today.
DanTup commentedon Oct 9, 2023
I've published a pre-release version with this fix so if you need it before the next stable update you can get it by switching here in VS Code:
It might take ~20min for the update to show up - it'll be version v3.75.20231009 and you'll need to click the Reload button after installing.
The pre-release should be pretty stable so there shouldn't be any urgent need to switch back.
Please let me know if you still have any problems with that version.
warcayac commentedon Oct 9, 2023
Web device is recognized now, I'll be testing this pre-release version along day I hope my PC doesn't go off , worse it doesn't even recognize me ;)
DanTup commentedon Oct 9, 2023
Great, thanks for confirming!
There's very little difference between stable/pre-release right now and there are quite a lot of users on pre-release, so I think you should be safe :-)
(but if you do hit any issues, please do let me know!)
Fix dart.env not being applied correctly