几天前我打开VSCode继续Flutter项目的工作,不幸的是,Flutter和Dart通常需要一段时间才能启动(2-3分钟),但这一次,扩展无法初始化,我没有扩展附带的工具。screenshot of the current state of things
在过去的几天里
- 删除并重新安装Flutter SDK(现在是3.3.7,Dart 2.18.4)
- 删除并重新安装VSCode(以前是snap,现在是.deb)
- 卸载并重新安装Flutter和Dart扩展(多次,每次重新启动VSCode)
- Ran说项目直接从终端,以确保我有Flutter工具正确安装(* Flutter运行 * 和 * Flutter构建apk* 运行良好,没有错误)
请在下面找到'flutter doctor -v'的结果
Flutter (Channel stable, 3.3.7, on Ubuntu 20.04.5 LTS 5.15.0-52-generic,
locale en_NG)
• Flutter version 3.3.7 on channel stable at
/home/alabi/snap/flutter/common/flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision e99c9c7cd9 (7 days ago), 2022-11-01 16:59:00 -0700
• Engine revision 857bd6b74c
• Dart version 2.18.4
• DevTools version 2.15.0
[!] Android toolchain - develop for Android devices (Android SDK version
32.1.0-rc1)
• Android SDK at /home/alabi/Android/Sdk
• Platform android-33, build-tools 32.1.0-rc1
• ANDROID_SDK_ROOT = /home/alabi/Android/Sdk
• Java binary at: /home/alabi/.jdks/openjdk-18.0.1.1/bin/java
• Java version OpenJDK Runtime Environment (build 18.0.1.1+2-6)
✗ Android license status unknown.
Run `flutter doctor --android-licenses` to accept the SDK licenses.
See https://flutter.dev/docs/get-started/install/linux#android-setup for
more details.
[✗] Chrome - develop for the web (Cannot find Chrome executable at
google-chrome)
! Cannot find Chrome. Try setting CHROME_EXECUTABLE to a Chrome executable.
[✓] Linux toolchain - develop for Linux desktop
• clang version 10.0.0-4ubuntu1
• cmake version 3.16.3
• ninja version 1.10.0
• pkg-config version 0.29.1
[!] Android Studio (not installed)
• Android Studio not found; download from
https://developer.android.com/studio/index.html
(or visit https://flutter.dev/docs/get-started/install/linux#android-setup
for detailed instructions).
[✓] VS Code (version 1.73.0)
• VS Code at /usr/share/code
• Flutter extension version 3.52.0
[✓] Connected device (1 available)
• Linux (desktop) • linux • linux-x64 • Ubuntu 20.04.5 LTS 5.15.0-52-generic
CLI命令'flutter --version'返回
Flutter 3.3.7 • channel stable • https://github.com/flutter/flutter.git
Framework • revision e99c9c7cd9 (7 days ago) • 2022-11-01 16:59:00 -0700
Engine • revision 857bd6b74c
Tools • Dart 2.18.4 • DevTools 2.15.0
所有这些都让我相信Flutter SDK安装正确,问题出在VSCode和扩展上
任何帮助都是赞赏的,谢谢!
3条答案
按热度按时间syqv5f0l1#
请确保使用Flutter/Dart的官方扩展。它们由Dart Code创建。
ctehm74n2#
修好了!
如果扩展中的某些内容已损坏,您可以尝试卸载扩展,然后从~/.vscode/extensions(启动dart-code的扩展)中删除它们,然后重新安装。
从DartCode的GitHub,阅读问题并修复here,如果你仍然感到困惑
kqqjbcuj3#
在我的情况下,我不得不安装一个旧版本的 dart 扩展,因为我的Flutter扩展说“没有激活”,直到我安装了旧的 dart 扩展