Repository navigation
Need to restart or flutter clean too often #16604
Description
The following note was added by @tvolkert on Oct 16, 2018
If you are affected by this bug,
please fill out the following form!
https://goo.gl/forms/eFPT6A3jAD8clU4o2 (Survey to gather information about this bug)
Steps to Reproduce
When I (or one of my teammates) run flutter flutter run (or with the run/debug button on IntelliJ and VSCode) on an AVD or on real devices, the installed version is always behind the newest one and I always need to restart the app or even sometimes flutter clean.
This is a problem especially when the build on the AVD/real device crashes, and the only solution here is to flutter clean, even when I stop the app running and do flutter run again.
The same happens when building and installing production APKs:
When I run flutter build and flutter install, the installed APK isn't updated.
If I run flutter clean, and next, again, flutter build and flutter install, the installed APK is up-to-date.
Flutter Doctor:
[√] Flutter (Channel beta, v0.2.8, on Microsoft Windows [Versione 10.0.17133.73], locale it-IT)
• Flutter version 0.2.8 at C:\Users\Edoardo Debenedetti\flutter
• Framework revision b397406561 (13 days ago), 2018-04-02 13:53:20 -0700
• Engine revision c903c217a1
• Dart version 2.0.0-dev.43.0.flutter-52afcba357
[√] Android toolchain - develop for Android devices (Android SDK 27.0.3)
• Android SDK at C:\Users\Edoardo Debenedetti\AppData\Local\Android\sdk
• Android NDK location not configured (optional; useful for native profiling support)
• Platform android-27, build-tools 27.0.3
• Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1024-b02)
• All Android licenses accepted.
[√] Android Studio (version 3.1)
• Android Studio at C:\Program Files\Android\Android Studio
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1024-b02)
[√] IntelliJ IDEA Ultimate Edition (version 2018.1)
• IntelliJ at C:\Users\Edoardo Debenedetti\AppData\Local\JetBrains\Toolbox\apps\IDEA-U\ch-0\181.4203.550
• Flutter plugin version 23.1.3
• Dart plugin version 181.4203.498
[√] VS Code, 64-bit edition (version 1.22.2)
• VS Code at C:\Program Files\Microsoft VS Code
• Dart Code extension version 2.11.2
[√] Connected devices (2 available)
• PRA LX1 • 57UDU17111026756 • android-arm64 • Android 7.0 (API 24)
• Android SDK built for x86 • emulator-5554 • android-x86 • Android 8.1.0 (API 27) (emulator)
• No issues found!
Activity
[-]Need to `restart` or `flutter clean` too often[/-][+]Need to restart or flutter clean too often[/+]ratsey commentedon Apr 28, 2018
Not alone in this - incredibly frustrating to have to 'flutter clean' with seemingly every code change before the changes are reflected in Android Studio debug.
escamoteur commentedon May 4, 2018
I encounter the same problem at the moment, how reload shows the latest changes but if I restart cold I get an old version only flutter clean helps.
iampawan commentedon May 4, 2018
+1 Same problem here and in fact for me flutter clean also doesn't help sometimes & I have to delete the app manually and then rebuild it. It is really annoying and frustrating.. :(
KgotsoK commentedon May 4, 2018
Also have been experiencing the same with Flutter.
UNRELATED: Funny thing is that I also had a similar issue with pure Android development. Android's Instant Run also left me with an older version once I restart the app after debugging.
iampawan commentedon May 4, 2018
@sethladd can you please help with this on priority basis ? It's like the major pro became the major con :(
escamoteur commentedon May 4, 2018
Totally agree. This is a major regression. Not long ago I wrote in a blog post how happy I was that Flutter tooling just worked compared to Xamarin but now it's almost worse. Hot reload too often doesn't work on current dev and Master branches
ratsey commentedon May 4, 2018
So frustrating. The Android Studio Debug button will typically not respect recent changes in the code, necessitating a flutter clean before running. Hot reload from Android Studio just doesn't work. If I run a terminal 'flutter run' the hot reload seems to work just fine, but of course I get no debugging tools.
What is run by a 'flutter run' command is clearly not the same code as is run using the Android Studio icons. It's to the point to debug I have to flutter clean every run which is horrific when trying to resolve issues.
UPDATE: The issue appears to be limited to debugging. Using Android Studio's 'run' icon is as fast as from the terminal and respects recent code changes. For some reason, attempting to debug always requires a flutter clean operation to respect recent code changes.
eseidelGoogle commentedon May 4, 2018
@cbracken @tvolkert sounds like a bad regression. Any ideas?
tvolkert commentedon May 4, 2018
@cbracken any chance this could be related to your work on fingerprinting and simplifying build code paths?
escamoteur commentedon May 4, 2018
Could it be a Windows problem? I'm on Windows too. Most devs seems to work on a Mac, so this might be a reason why this hasn't come up earlier? Just a guess
223 remaining items
filiph commentedon Mar 25, 2020
Should we close this? For what it's worth, I am not seeing the issue anymore. And I see that at least one underlying bug was fixed recently.
It's also possible we might want to split this into several issues, and use this one as a tracking meta-issue.
Reprevise commentedon Mar 25, 2020
I haven't had this issue in awhile, I'm on the latest beta 1.15.17.
zanderso commentedon Mar 25, 2020
I suspect that we'll find more focused issues to be more useful/actionable. @jonahwilliams wdyt?
ride4sun commentedon Mar 25, 2020
I don't see the issue anymore. I am on channel beta.
starlight173 commentedon Mar 26, 2020
The issue seems gone away in stable channel (1.12.13 hotfix 8)
cmaccarone commentedon Mar 31, 2020
I have version 1.12.13 hotfix 8 and I seem to be having this problem still. I ran
flutter clean
and it seemed to fix the issue temporarily at least
dev-paulperez commentedon Apr 5, 2020
This fix the problem for me!! (Update Dart and Flutter too).
antheus-s commentedon Apr 7, 2020
I have followed the "flutter pub cache repair" solution but now my hot reload doesn't work anymore and I need to flutter clean for every build. Any other suggestions?
eseidelGoogle commentedon Apr 7, 2020
@antheuss that sounds like it might be a separate issue, which I'm very interested in understanding. Would you be willing to file a new issue with your specific concerns so we can help you get them resolved? Thanks!
ngominhtrungit commentedon Apr 10, 2020
Thanks a lot, I fixed it.
boucoding commentedon Apr 12, 2020
same issue on the last version on stable channel
antheus-s commentedon Apr 13, 2020
I actually fixed it by reïnstalling my complete development environment after executing the commands described earlier. Thank you very much though. :-)
zanderso commentedon Apr 13, 2020
This issue has gotten a bit long and overloaded. @jonahwilliams work in this area should have addressed the bulk of the problems. If folks still have issues that are fixed by a
flutter clean, please file a new issue with full details. Thanks!