'Flutter Hot Reload and Hot Restart do not always work
For now one week, sometimes when I HotReload my changes are not applied (the log says it's been HotReload but in fact, they are not) and the same when I HotRestart so I'm forced to stop and re-run the app (and sometimes to delete the build)!
Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel beta, v1.15.17, on Microsoft Windows [version 10.0.17763.1098], locale fr-FR)
[√] Android toolchain - develop for Android devices (Android SDK version 29.0.3)
[√] Chrome - develop for the web
[√] Android Studio (version 3.6)
[√] Connected device (3 available)
• No issues found!
I run my app on Android Emulator 9 Pie.
EDIT: I tried to invalidate the cache of AndroidStudio and restart, and also tried on another emulator but it didn't solve the issue...
Solution 1:[1]
My problem was a bad import
import 'file:///C:/Users/plest/StudioProjects/the_spot/lib/pages/home_page/Map/map.dart' ;
instead of
import 'package:the_spot/pages/home_page/Map/map.dart' ;
I don't know why the import changed by itself...
Solution 2:[2]
try changing your channel, for example run flutter channel master .
worked for me
Solution 3:[3]
Solution is always depends the problem. Many reasons may cause the issue.
Method 1 : Re-install Flutter Plugin
- This is the best solutions for your problem. First of all, uninstall the flutter.
- File -> Settings -> Plugins (on MacOs: Preference -> Plugins)
- Select Flutter. Uninstall (You might restart the IDE)
- Now re-install the flutter.
- File -> Settings -> Plugins (on MacOs: Preference -> Plugins)
- Select ‘Browse repositories’.
- Now search for ‘Flutter’. Select ‘Flutter’.
- Install.
Method 2 : The android project should be on running stage on android studio or your IDE
Method 3 : Make sure your application is open and not closed by you after running.
- The application should be active, phone is not locked and light is on. Hot Reload will not work if you close the application.
Solution 4:[4]
uninstall & after re-install flutter plugin from setting will make this right
Solution 5:[5]
After installation. I rebooted my mac and suddenly it was way faster!
Solution 6:[6]
It could be a proxy problem. Please try to close it.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Milvintsiss |
| Solution 2 | SO 80 |
| Solution 3 | Paresh Mangukiya |
| Solution 4 | Murshid Ahamed |
| Solution 5 | tbrodbeck |
| Solution 6 | Edison xu |
