我正在尝试启动一个新的 flutter 项目;我是初学者。我通过 VSC Code 中的命令选项板创建了一个新项目,并从顶部栏下拉列表启动了新项目。然后我创建了一个文件夹“New Flutter Project”。然后我只是尝试运行该应用程序(我没有添加任何内容)并看到它显示在 iOS 模拟器中。但我收到了这个错误:
Unable to find the library for file:///Users/myname/Desktop/NewFlutterProject/newflutterproject/lib/main.dart
\#0 DartDebugAdapter.evaluateRequest (package:dds/src/dap/adapters/dart.dart:1060:7)
\<asynchronous suspension\>
\#1 BaseDebugAdapter.handle (package:dds/src/dap/base_debug_adapter.dart:141:7)
\<asynchronous suspension\>
然后我在我的终端上运行 flutter doctor ,它说 cocopandas 没有正确安装。我之前已经安装过它,所以我不知道为什么它没有说没有。然后我重新安装了 homebrew 和 cocopandas。然后我检查了 VSCode 问题是否已解决,但没有解决。
然后我再次尝试 flutter doctor,问题变得更糟。现在我的终端显示:
Doctor summary (to see all details, run flutter doctor -v):
[!] Flutter (Channel stable, 3.16.5, on macOS 14.2.1 23C71 darwin-arm64, locale
en-US)
! Warning: `dart` on your path resolves to
/opt/homebrew/Cellar/dart/3.2.4/libexec/bin/dart, which is not inside your
current Flutter SDK checkout at /Users/oliverroberts/development/flutter.
Consider adding /Users/oliverroberts/development/flutter/bin to the front
of your path.
[!] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
✗ cmdline-tools component is missing
Run `path/to/sdkmanager --install "cmdline-tools;latest"`
See https://developer.android.com/studio/command-line for more details.
✗ Android license status unknown.
Run `flutter doctor --android-licenses` to accept the SDK licenses.
See https://flutter.dev/docs/get-started/install/macos#android-setup for
more details.
[✓] Xcode - develop for iOS and macOS (Xcode 15.1)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2023.1)
[✓] VS Code (version 1.85.1)
[✓] Connected device (3 available)
[✓] Network resources
! Doctor found issues in 2 categories
您是否在系统环境变量中设置了路径?该视频对开始使用 flutter 之前设置环境路径提供了很好的指导。
视频链接在这里。查看此链接
因为从这位 flutter doctor 看来,这是一个路径问题。
!警告:您路径上的
决定 /opt/homebrew/Cellar/dart/3.2.4/libexec/bin/dart,它不在您的内部 当前的 Flutter SDK 位于 /Users/oliverroberts/development/flutter。 考虑将 /Users/oliverroberts/development/flutter/bin 添加到前面 你的道路。dart