Flutter + Sonoma OSX 更新打破热重载和热重启

问题描述 投票:0回答:1

最近将我的 OSX 更新到 Sonoma 后,我的 Flutter 开发环境无法再热重载。

当 VS Code 尝试热重载或热重启时,我不断收到此错误消息:

Failed to Hot Reload: DebugAdapterException: Flutter failed to create file at "/Users/hotdog/Library/Containers/com.example.firstApp/Data/tmp/first_app2fr7NB/first_app/main.dart.incremental.dill".
Please ensure that the SDK and/or project is installed in a location that has read/write permissions for the current user.

热重启的类似消息:

Failed to Hot Restart: DebugAdapterException: Flutter failed to create file at "/Users/hotdog/Library/Containers/com.example.firstApp/Data/tmp/first_appnSNkrN/first_app/main.dart.dill".
Please ensure that the SDK and/or project is installed in a location that has read/write permissions for the current user.

除了 Android 工具链之外,因为我不是为 Android 开发,所以调用

flutter doctor
检查没有任何问题。

Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.13.7, on macOS 14.0 23A344 darwin-x64, locale en-US)
[!] 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.0.1)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2022.3)
[✓] VS Code (version 1.84.2)
[✓] Connected device (3 available)
[✓] Network resources

! Doctor found issues in 1 category.

查看

/Users/hotdog/Library/Containers/
,文件夹
com.example.firstApp
根本不存在。

还有其他人经历过这种情况吗?

我猜这与更新后重置权限有关,特别是

~/Library/Containers
文件夹。

flutter macos-sonoma flutter-hotreload flutter-hotrestart
1个回答
0
投票

我也遇到了同样的问题,所以我所做的只是重新启动 VScode 并确保为 flutter SDK 进行了正确的配置设置。

© www.soinside.com 2019 - 2024. All rights reserved.