在Mac上已经将Flutter与VSCode一起使用了几个月没有问题,但是突然Flutter Doctor产生了以下信息:
[✓] Flutter (Channel beta, v0.5.1, on Mac OS X 10.13.4 17E202, locale en-US) • Flutter version 0.5.1 at [Path]/flutter • Framework revision c7ea3ca377 (3 weeks ago), 2018-05-29 21:07:33 +0200 • Engine revision 1ed25ca7b7 • Dart version 2.0.0-dev.58.0.flutter-f981f09760 [✓] Android toolchain - develop for Android devices (Android SDK 27.0.3) • Android SDK at [Path]/Library/Android/sdk • Android NDK location not configured (optional; useful for native profiling support) • Platform android-27, build-tools 27.0.3 • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1024-b01) • All Android licenses accepted. [✓] iOS toolchain - develop for iOS devices (Xcode 9.3.1) • Xcode at /Applications/Xcode.app/Contents/Developer • Xcode 9.3.1, Build version 9E501 • ios-deploy 1.9.2 • CocoaPods version 1.5.2 [✓] Android Studio (version 3.1) • Android Studio at /Applications/Android Studio.app/Contents • Flutter plugin version 25.0.1 • Dart plugin version 173.4700 • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1024-b01) [!] VS Code (version 1.24.1) • VS Code at /Applications/Visual Studio Code.app/Contents • Flutter extension not installed; install from https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter [✓] Connected devices (1 available) • Android SDK built for x86 • emulator-5554 • android-x86 • Android 9 (API 28) (emulator) ! Doctor found issues in 1 category.
我可以确认已安装颤振,自从我开始使用它以来什么都没有改变。另外,在我更新颤振(今天)之前,颤振医生在VSCode下阅读如下:
[!] VS Code (version 1.24.1) • VS Code at /Applications/Visual Studio Code.app/Contents • Dart Code extension not installed; install from https://marketplace.visualstudio.com/items?itemName=Dart-Code.dart-code
但是,升级后似乎无法找到飞镖的问题可能已得到解决。
几天前这里有一篇帖子,表明Flutter Doctor可能暂时不准确,所以我尝试运行该项目,并得到以下错误堆栈:
Using hardware rendering with device Android SDK built for x86. If you get graphics artifacts, consider enablingsoftware rendering with "--enable-software-rendering". Launching lib/main.dart on Android SDK built for x86 in debug mode... Initializing gradle... 2.0s Resolving dependencies... 2.2s Running 'gradlew assembleDebug'... Error: unable to locate asset entry in pubspec.yaml: "ios/Flutter/flutter_assets/fonts/MyFlutterApp.ttf". Error building assets FAILURE: Build failed with an exception. * Where: Script '[Path]/flutter/packages/flutter_tools/gradle/flutter.gradle' line: 435 * What went wrong: Execution failed for task ':app:flutterBuildDebug'. > Process 'command '[Path]/flutter/bin/flutter'' finished with non-zero exit value 1 * Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. * Get more help at https://help.gradle.org BUILD FAILED in 17s Gradle build failed: 1 MacBook-Pro-3:rambleapp TrentKennelly$ flutter trace Error connecting to observatory: Exception: Attempted to connect to Dart observatory 5 times, and all attempts failed. Giving up. The URL was ws://127.0.0.1:8100/ws
有什么想法吗?
VSCode发生了更改,导致扩展检测失败。可以忽略此警告。
见丹尼Tuppeny的全部评论,这个问题在这里。
对于stacktrace,有两件事:
"ios/Flutter/flutter_assets/fonts/MyFlutterApp.ttf"
您检查资产是否仍然存在?没有它,该项目将无法编译,天文台问题可能与此有关。