flutter - 第一次尝试后热重载卡住

标签 flutter visual-studio-code hot-reload

我正在使用vscode开发flutter应用程序,我不知道发生了什么!当我保存项目并尝试热重载一次时,它的工作和热重载通知( Performing hot reload )保留在 vscode 的底部,下次热重载不起作用。
enter image description here
Vscode 不会抛出任何错误或其他问题来解决问题,因此我使用 run 运行应用程序命令和热重载后,结果如下:

Flutter run key commands.
r Hot reload. 🔥🔥🔥
R Hot restart.
h Repeat this help message.
d Detach (terminate "flutter run" but leave application running).
c Clear the screen
q Quit (terminate the application on the device).
An Observatory debugger and profiler on sdk gphone x86 arm is available at: http://127.0.0.1:40989/zVisdoiRRE8=/

Flutter DevTools, a Flutter debugger and profiler, on sdk gphone x86 arm is available at: http://127.0.0.1:9101?uri=http%3A%2F%2F127.0.0.1%3A40989%2FzVisdoiRRE8%3D%2F

Running with unsound null safety
For more information see https://dart.dev/null-safety/unsound-null-safety

Performing hot reload...  
现在,当我按 r 时,热重载不起作用。
我正在使用 fvm,这是我的 sdk 版本:
$ flutter doctor -v
[✓] Flutter (Channel unknown, 2.0.6, on Linux, locale en_US.UTF-8)
    • Flutter version 2.0.6 at /home/alt/fvm/versions/2.0.6
    • Framework revision 1d9032c7e1 (5 weeks ago), 2021-04-29 17:37:58 -0700
    • Engine revision 05e680e202
    • Dart version 2.12.3

[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
    • Android SDK at /mnt/SSDP/Sdk/android/
    • Platform android-S, build-tools 30.0.3
    • ANDROID_HOME = /mnt/SSDP/Sdk/android
    • ANDROID_SDK_ROOT = /mnt/SSDP/Sdk/android/
    • Java binary at: /mnt/SSDP/android-studio/jre/bin/java
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6222593)
    • All Android licenses accepted.

[✓] Chrome - develop for the web
    • Chrome at google-chrome

[✓] Android Studio
    • Android Studio at /mnt/SSDP/android-studio/
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • android-studio-dir = /mnt/SSDP/android-studio/
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6222593)

[✓] VS Code (version 1.56.2)
    • VS Code at /usr/share/code
    • Flutter extension version 3.23.0

[✓] Connected device (2 available)
    • Android SDK built for x86 (mobile) • emulator-5554 • android-x86    • Android 10 (API 29)
      (emulator)
    • Chrome (web)                       • chrome        • web-javascript • Google Chrome
      91.0.4472.77

• No issues found!
  • 我在 Android Studio 中也遇到了这个问题。
  • 最佳答案

    如果我面对它,我将终止 gradle 的每个实例并且它运行良好。热重载再次起作用。在 linux 上的命令行:

    ps aux | grep gradle | awk '{print $2}' | xargs kill
    

    关于flutter - 第一次尝试后热重载卡住,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/67793167/

    相关文章:

    flutter - 在 flutter 中使用 TabBarView 获取 'Horizontal viewport was given unbounded height.'

    git - 如何在 vs code 中显示完整文件的 git blame

    visual-studio - 强制转换为 "keyof T"是否有效或会导致编译错误?

    visual-studio-code - 从 NW ABAP 系统检索 sapui5 BSP

    node.js - React NodeJS 开发流程

    flutter - 生成应用时出现“Another exception was thrown: Invalid argument(s)”错误

    flutter - 如何制作类似滚轴的动画?类似于 老虎机

    flutter - 如何关闭 Navigator.of(context).overlay

    visual-studio - 热重载在 Visual Studio 2022 中不起作用 - C#(未发现代码更改)

    javascript - 用于 sass 的 webpack live 热重载