Dart-Code: Flutter SDK installed with Snap is not found when using the Debian package version of VS Code
When I try to start a new Flutter Project I get this error:
Could not find a Flutter SDK. Please ensure flutter is installed and in your PATH (you may need to restart).
From command line which flutter
gives /snap/bin/flutter
which points to /usr/bin/snap*
(which is not a symlink). I can also run flutter through
/snap/flutter/current/flutter.sh
.
Locate SDK does not work for me. I navigate to /snap/bin
and press Set Flutter SDK folder and get That folder does not appear to be a Flutter SDK
. I get the same error from /snap/flutter/current/flutter.sh
Logs from trying to start a new flutter project:
[2:12:51 PM] [General] [Info] Searching for SDKs...
[2:12:51 PM] [General] [Info] Environment PATH:
[2:12:51 PM] [General] [Info] /home/cfujimori/.local/bin
[2:12:51 PM] [General] [Info] /home/cfujimori/lib/bes/gcc-arm-none-eabi-4_9-2014q4/bin/
[2:12:51 PM] [General] [Info] /usr/local/STMicroelectronics/STM32Cube/STM32CubeProgrammer/bin
[2:12:51 PM] [General] [Info] /usr/local/bin
[2:12:51 PM] [General] [Info] ...
[2:12:51 PM] [General] [Info] /snap/flutter/current/bin
[2:12:51 PM] [General] [Info] /home/cfujimori/.local/bin/
[2:12:51 PM] [General] [Info] /snap/bin
[2:12:51 PM] [General] [Info] /snap/flutter/current/bin
[2:12:51 PM] [General] [Info] /home/cfujimori/STMicroelectronics/STM32Cube/STM32CubeProgrammer/bin/
[2:12:51 PM] [General] [Info] Searching for flutter
[2:12:51 PM] [General] [Info] Looking for flutter in:
[2:12:51 PM] [General] [Info] /home/cfujimori/.local/bin
[2:12:51 PM] [General] [Info] /home/cfujimori/lib/bes/gcc-arm-none-eabi-4_9-2014q4/bin/
[2:12:51 PM] [General] [Info] /usr/local/STMicroelectronics/STM32Cube/STM32CubeProgrammer/bin
[2:12:51 PM] [General] [Info] /usr/local/bin
[2:12:51 PM] [General] [Info] ...
[2:12:51 PM] [General] [Info] .../bin
[2:12:51 PM] [General] [Info] /snap/flutter/current/bin
[2:12:51 PM] [General] [Info] /home/cfujimori/.local/bin/
[2:12:51 PM] [General] [Info] /snap/bin
[2:12:51 PM] [General] [Info] /snap/flutter/current/bin
[2:12:51 PM] [General] [Info] /home/cfujimori/STMicroelectronics/STM32Cube/STM32CubeProgrammer/bin/
[2:12:51 PM] [General] [Info] Found at:
[2:12:51 PM] [General] [Info] /snap/bin
[2:12:51 PM] [General] [Info] Following symlink: /snap/bin/flutter ==> /usr/bin/snap
[2:12:51 PM] [General] [Info] Candidate paths to be post-filtered:
[2:12:51 PM] [General] [Info] /usr
[2:12:51 PM] [General] [Info] Returning SDK path undefined for flutter
[2:12:51 PM] [General] [Info] Searching for dart
[2:12:51 PM] [General] [Info] Looking for dart in:
[2:12:51 PM] [General] [Info] /home/cfujimori/.local/bin
[2:12:51 PM] [General] [Info] /home/cfujimori/lib/bes/gcc-arm-none-eabi-4_9-2014q4/bin/
[2:12:51 PM] [General] [Info] /usr/local/STMicroelectronics/STM32Cube/STM32CubeProgrammer/bin
[2:12:51 PM] [General] [Info] /usr/local/bin
[2:12:51 PM] [General] [Info] ...
[2:12:51 PM] [General] [Info] .../bin
[2:12:51 PM] [General] [Info] /snap/flutter/current/bin
[2:12:51 PM] [General] [Info] /home/cfujimori/.local/bin/
[2:12:51 PM] [General] [Info] /snap/bin
[2:12:51 PM] [General] [Info] /snap/flutter/current/bin
[2:12:51 PM] [General] [Info] /home/cfujimori/STMicroelectronics/STM32Cube/STM32CubeProgrammer/bin/
[2:12:51 PM] [General] [Info] Found at:
[2:12:51 PM] [General] [Info] Candidate paths to be post-filtered:
[2:12:51 PM] [General] [Info] Returning SDK path undefined for dart
[2:12:51 PM] [General] [Info] !! PLEASE REVIEW THIS LOG FOR SENSITIVE INFORMATION BEFORE SHARING !!
Dart Code extension: 3.14.1
Flutter extension: 3.14.1 (not activated)
App: Visual Studio Code
Version: 1.47.3
Platform: linux
Workspace type: Unknown (No SDK)
Analyzer type: DAS
Multi-root?: undefined
Dart SDK:
Loc: undefined
Ver: undefined
Flutter SDK:
Loc: undefined
Ver: undefined
HTTP_PROXY: undefined
NO_PROXY: undefined
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Comments: 27 (19 by maintainers)
@chf2117, it may be that your copy of the Flutter SDK has corrupted somehow.
Please try re-initialising the SDK like so:
Then relaunch VS Code.
Yeah all links in
/snap/bin/*
point to/usr/bin/snap
, nothing wrong there.Looks like the issue here is that the extension expects to find the snap in
/snap/
but Arch Linux stores it in/var/lib/snapd/snap/
. @teohhanhui, to work around this, click the “Locate SDK” button in the popup and browse to/home/teohhanhui/snap/flutter/common/flutter
(as shown in yourflutter doctor
output). Alternatively (as suggested above) you could try the VS Code snap (snap install code --classic
).@DanTup, it may not be a bad idea for the extension to actually scrape the output of
flutter doctor -v
to locate the SDK path rather than following the link. wdyt?I wouldn’t expect so. I did wonder if it was a version of the extension without the Snap work (that would cause this behaviour and no Snap-specific code in the log), however the log above says 3.14.1 which is the most recent.
If installing the latest VS Code doesn’t help, I can make a dev build that has additional logging so we can figure out exactly why it’s not getting to that code and go from there.