VSCode hot reload for Flutter does not work

后端 未结 14 1170
野性不改
野性不改 2021-01-11 11:50

I\'m on VSCode right now working on my flutter application when hot reload just stops working, right in the middle of my development. I have absolutely no idea why this happ

相关标签:
14条回答
  • 2021-01-11 12:27

    I found a way to force the hot reload in VS Code, which is very useful for those stuck in this situation: after the application is running, simply click on the debug option at the bottom of the VS Code editor whem the button is already named "Flutter" and, after choosing "flutter" again at the "Debug Configuraion" top floating window, you will be notified that the application is already being debugged, but the hot reload will occur.

    0 讨论(0)
  • 2021-01-11 12:28

    For flutter hot reload problems that may be happening with your project,

    It is a problem with your device, and not flutter or Android Studio

    This happens when your logcat hangs up.

    You might want to increase your buffer size.

    To do this, go into your device or emulator:

    Settings > Developer options (Ensure they are turned on),

    Change the buffer size to a higher number.

    Then run flutter run -v again

    0 讨论(0)
  • 2021-01-11 12:33

    with VS Code(v1.44.1), Android Studio(v3.6.2), Flutter v1.12.13+hotfix.9 on Linux

    Android studio > at Startup window > configure > AVD manager > run one virtual device > confirm VS Code(v1.44.1) has your running virtual device shown in lower right corner

    VS Code > Run(at top, next to Help) > Start debugging(F5) or Start without debugging(Ctrl + F5)

    Save your Flutter code in VS Code Then the emulator should be triggered for hot reload

    0 讨论(0)
  • 2021-01-11 12:34

    first save your project then hot reload it.

    0 讨论(0)
  • 2021-01-11 12:36

    Here are the official documented cases where hot reload wont work:

    1. Data regarding the sate of the app is changed (since Flutter tries to maintain the state of your app between hot reloads)
    2. Change in global variables or static field since Flutter regards them as state
    3. Changes to anything that are not in the build path (eg. initState()) and also the app's main itself
    4. You've got compilation errors, check debug console to be sure
    5. App is killed either by user or by OS because of inactivity
    6. When Enumerated types are changed to to regular classes or vise versa
    7. Font is changed
    8. When Generic type decorations are modified
    9. When included native code (Java, Kotlin or Swift) is modified
    10. CupertinoTabView builder widget

    reference: Hot Reload

    0 讨论(0)
  • 2021-01-11 12:37

    For VS Code Go to File>Autosave Make sure you have "check" Autosave.

    0 讨论(0)
提交回复
热议问题