Flutter: Need to restart or flutter clean too often

Created on 15 Apr 2018  ·  235Comments  ·  Source: flutter/flutter

---


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!
annoyance crowd regression gradle hot reload xcode tool

Most helpful comment

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.

All 235 comments

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.

[√] Flutter (Channel master, v0.3.6-pre.43, on Microsoft Windows [Version 10.0.16299.371], locale en-US)
    • Flutter version 0.3.6-pre.43 at E:\flutter
    • Framework revision 32d1f0a80a (17 hours ago), 2018-04-27 13:34:50 -0700
    • Engine revision e11905c6e5
    • Dart version 2.0.0-dev.50.0.flutter-8d4074175f

[√] Android toolchain - develop for Android devices (Android SDK 27.0.3)
    • Android SDK at C:\Users\jens\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: E:\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 E:\Program Files\Android\Android Studio
    • Flutter plugin version 24.0.1
    • Dart plugin version 173.4700
    • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1024-b02)

[√] IntelliJ IDEA Community Edition (version 2018.1)
    • IntelliJ at E:\Program Files\JetBrains\IntelliJ IDEA Community Edition 181.4203.6
    • Flutter plugin version 22.2.3
    • Dart plugin version 181.4096.12

[√] 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 (1 available)
    • Android SDK built for x86 • emulator-5554 • android-x86 • Android 7.1.1 (API 25) (emulator)

• No issues found!

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.

+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.. :(

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.

@sethladd can you please help with this on priority basis ? It's like the major pro became the major con :(

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

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.

[√] Flutter (Channel master, v0.3.6-pre.43, on Microsoft Windows [Version 10.0.16299.371], locale en-US)
    • Flutter version 0.3.6-pre.43 at E:\flutter
    • Framework revision 32d1f0a80a (7 days ago), 2018-04-27 13:34:50 -0700
    • Engine revision e11905c6e5
    • Dart version 2.0.0-dev.50.0.flutter-8d4074175f

[√] Android toolchain - develop for Android devices (Android SDK 27.0.3)
    • Android SDK at C:\Users\jens\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: E:\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 E:\Program Files\Android\Android Studio
    • Flutter plugin version 24.0.1
    • Dart plugin version 173.4700
    • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1024-b02)

[√] IntelliJ IDEA Community Edition (version 2018.1)
    • IntelliJ at E:\Program Files\JetBrains\IntelliJ IDEA Community Edition 181.4203.6
    • Flutter plugin version 22.2.3
    • Dart plugin version 181.4096.12

[√] 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 (1 available)
    • Android SDK built for x86 • emulator-5554 • android-x86 • Android 7.1.1 (API 25) (emulator)

• No issues found!

@cbracken @tvolkert sounds like a bad regression. Any ideas?

@cbracken any chance this could be related to your work on fingerprinting and simplifying build code paths?

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

I’m facing this problem on mac btw.

On Fri, 4 May 2018 at 8:06 PM, escamoteur notifications@github.com wrote:

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


You are receiving this because you commented.
Reply to this email directly, view it on GitHub
https://github.com/flutter/flutter/issues/16604#issuecomment-386621398,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AMCOnM-6r56bzBF5c4kpjOkSsAyexeO_ks5tvGdzgaJpZM4TVhip
.

Just chatted with @cbracken - sounds like this was fixed on master 3 days ago in https://github.com/flutter/flutter/pull/17175

@ratsey if you flutter upgrade, you should pick up the fix. Please let us know if you still see it happening when you're synced to a commit after 752906498ae9961008e9336a1c88aa14f8ac068f

@dedeswim this fix may not land on the beta channel for several weeks. You can see it sooner by running flutter channel dev or right away with flutter channel master 😄

@volkert i have upgraded flutter today itself 8 hours ago in master channel
and it is not yet fixed for me.

On Fri, 4 May 2018 at 8:09 PM, Todd Volkert notifications@github.com
wrote:

Just chatted with @cbracken https://github.com/cbracken - sounds like
this was fixed on master 3 days ago in #17175
https://github.com/flutter/flutter/pull/17175

@ratsey https://github.com/ratsey if you flutter upgrade, you should
pick up the fix. Please let us know if you still see it happening when
you're synced to a commit after 7529064
https://github.com/flutter/flutter/commit/752906498ae9961008e9336a1c88aa14f8ac068f

@dedeswim https://github.com/dedeswim this fix may not land on the beta
channel for several weeks. You can see it sooner by running flutter
channel dev or right away with flutter channel master 😄


You are receiving this because you commented.
Reply to this email directly, view it on GitHub
https://github.com/flutter/flutter/issues/16604#issuecomment-386622251,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AMCOnJCY9QCtdFuMdaU2xTt6fFPvVQpcks5tvGgkgaJpZM4TVhip
.

@iampawan good to know - we'll certainly have a look today. This is on Android debug builds?

Yes I have only tried the debug build.. I was using ios simulator and even
flutter clean was not working for me . I had to delete the app . But then
another thing i noticed was that if i run my app again and again 2-3 times
then changes reflects.. still don’t know how to fix this but this happens
when app freezes during hot reload

On Fri, 4 May 2018 at 8:15 PM, Todd Volkert notifications@github.com
wrote:

@iampawan https://github.com/iampawan good to know - we'll certainly
have a look today. This is on Android debug builds?


You are receiving this because you were mentioned.

Reply to this email directly, view it on GitHub
https://github.com/flutter/flutter/issues/16604#issuecomment-386624223,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AMCOnNxuo-c8uFwQkrw0C1BBXMqAGcd4ks5tvGmhgaJpZM4TVhip
.

Quick poll for those following along in case it helps identify a pattern where this is happening (sounds like OS has already been ruled out since we have reports from both Windows and MacOS): which of the following apply to you:

  • Android vs iOS
  • physical device vs emulator/simulator
  • debug, profile, or release build
  • Android build
  • Windows machine
  • emulator. & device
  • Updated this morning.
  • Debug only tested yet

It is even weirder, I make a change and an Instant Reload and the change shows up. I quit and restart the app without Flutter clean and I get the old version.

  1. Android and iOS both .. i just verified it
  2. Physical as well as emulator device
  3. I have tried debug only
  4. For me it happens lesser in android studio but more when i use vscode (
    may be this is irrelevant because i don’t know )

On Fri, 4 May 2018 at 8:20 PM, Todd Volkert notifications@github.com
wrote:

Quick poll for those following along in case it helps identify a pattern
where this is happening (sounds like OS has already been ruled out since we
have reports from both Windows and MacOS): which of the following apply to
you:

  • Android vs iOS
  • physical device vs emulator/simulator
  • debug, profile, or release build


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/flutter/flutter/issues/16604#issuecomment-386625760,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AMCOnP1SMbNrtH7hn11XZOR7SVxFyTtaks5tvGrRgaJpZM4TVhip
.

It is even weirder, I make a change and an Instant Reload and the change shows up. I quit and restart the app without Flutter clean and I get the old version.

That sounds like an issue rebuilding the kernel file for the app (build/app.dill). The initial app run build a kernel file and starts the app from it; the first hot reload populates all the app's (kernel) source into an in-memory on device devfs file system and reloads from there; subsequent reloads populates file deltas into that memory file system.

/cc @aam

17175 should only have fixed an invalidation issue for profile/release builds. Debug builds use a different code path.

I'm not able to reproduce this bug with simple code changes to the gallery demo testing with iOS debug simulator on master, using just the command-line tools. I'll give a go through an IDE, which uses the daemon and keep poking at it till we sort out what's up.

@iampawan @escamoteur were you seeing the bad behaviour with code changes or asset changes (or both)?

were you seeing the bad behaviour with code changes or ...

And if code changes, was it Dart code, or Java/ObjC code?

Also, has anyone reproduced this at the command-line, or always in an IDE?

I'm not able to repro this neither from IJ, nor from command line(on physical Android device).
I'm starting Flutter Gallery, making simple change(lib/gallery/app.dart:128 'Flutter Gallery' -> 'Updated Flutter Gallery'), hot-reload, confirm I see the change(title of the app changes), stop the app, start it again, still see the change.

This is on 24.0.1 of Flutter IJ plugin, master branch of Flutter:

Flutter 0.3.6-pre.113 • channel master • [email protected]:aam/flutter.git Framework • revision d820e5f3b1 (12 hours ago) • 2018-05-03 22:27:29 -0700 Engine • revision e976be13c5 Tools • Dart 2.0.0-dev.53.0.flutter-e6d7d67f4b

@devoncarew wrote

That sounds like an issue rebuilding the kernel file for the app (build/app.dill).

Next time you start the app, build/app.dill should be rebuilt because sources are newer than the dill file.

@cbracken have only tried with Dart code changes yet. If we can help with log files if there are, let us know.
Sorry for the delay, but timezones make it difficult.

I m using VS code if that makes a difference

@escamoteur log files would be great. If you run flutter -v run ... with the usual flutter run arguments, you’ll get more detailed output. From Android Studio you can edit your run configuration to specify —verbose in the additional options field.

This log is after flutter clean
afterflutterclean.txt

Then I modified something and run it without the change taking affect

afterchange.txt

Then after another flutter clean

afterfluttercleanafterchange.txt

I zipped the whole project. The button in the App should after the change be blue but isn't
Don't know if you can reproduce it from the zip file

https://drive.google.com/open?id=1r2lQPVW3TgJpK4RH_kyrRXyePIyw7_UY

PS C:\Entwicklung\BlogTwo way binding in Flutter\two_way_binding> flutter -v doctor
[√] Flutter (Channel master, v0.3.7-pre.9, on Microsoft Windows [Version 10.0.17134.1], locale de-DE)
• Flutter version 0.3.7-pre.9 at C:\Entwicklung\Flutter
• Framework revision b2b4665926 (19 hours ago), 2018-05-04 18:17:35 -0700
• Engine revision e976be13c5
• Dart version 2.0.0-dev.53.0.flutter-e6d7d67f4b

[√] Android toolchain - develop for Android devices (Android SDK 27.0.3)
• Android SDK at C:\Users\escam\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\jrebin\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
• Flutter plugin version 23.2.2
• Dart plugin version 173.4700
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1024-b02)

[√] VS Code, 32-bit edition (version 1.22.2)
• VS Code at C:\Program Files (x86)\Microsoft VS Code
• Dart Code extension version 2.12.1

[√] Connected devices (1 available)
• Android SDK built for x86 • emulator-5554 • android-x86 • Android 6.0 (API 23) (emulator)

• No issues found!

Unfortunately I will be on the road till Tuesday,

I had to change the min SDK and SDK location, and my Flutter did upgrade to get @escamoteur 's zip to run on my setup.

I am able to change the button colour in Debug with a hot-reload, and also change the colour between debug runs. Bottom line - @escamoteur 's project is working for me.

I'll try with my code again later this evening with this Flutter upgrade.

Any insights through the logs? @cbracken

@cbracken @tvolkert I am using the latest flutter version and today the freeze thing has increased while using vscode but i didn't face any issue like latest changes in the app is now reflecting which was not earlier .. But app freezes while changing something in stateful classes and i think it's less or not happening when i am using terminal for hot reload

I am using the latest flutter version and today the freeze thing has increased while using vscode

Are you on Windows? There seems to be a major bug in the April update that's causing freezing with Chrome-based apps:

https://www.engadget.com/2018/05/03/microsoft-windows-10-chrome-cortana-freeze-fix/

No , I'm using Macosx latest version

On Tue, May 8, 2018, 5:51 PM Danny Tuppeny notifications@github.com wrote:

I am using the latest flutter version and today the freeze thing has
increased while using vscode

Are you on Windows? There seems to be a major bug in the April update
that's causing freezing with Chrome-based apps:

https://www.engadget.com/2018/05/03/microsoft-windows-10-chrome-cortana-freeze-fix/


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/flutter/flutter/issues/16604#issuecomment-387383846,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AMCOnDF0oDTkjXNK1ZasxOD9jVuZP8TSks5twY3KgaJpZM4TVhip
.

Ok, not that then. When you say "the app freezes", do you mean the mobile app on the device (or the VS Code app)? I think that's probably a different issue to not-rebuilding-properly so it may be worth opening another issue. If you're using VS Code I'd be interested in seeing Flutter Run and Observatory logfiles for the period when you're seeing freezes.

@DanTup Here in the Step1 see the bottom Appbar color and also the app freezes when the 'Performing hot reload' notification takes time - say more than 5 secs. Now step 2 is when i rebuild the app now changes are gone and if i will make some change and perform hot reload then all changes will be reflected .. now let's do hot reloading 3 to 4 times and again app freezes .. Some files are attached
step1
step2
observatory.txt

@iampawan I think this is a different issue; could you open a new issue about it to avoid confusing things with the not-rebuilding-when-it-should issue? Also, can you include the Flutter Run log as well as Observatory one, since that one includes the instructions for hot reloading. Thanks!

@iampawan That log doesn't seem to include any requests to hot reload, the last line is when the app finishes launching. Could you try again, but also attach it to a new issue - I don't these issues hot reloading are the same as the app not rebuilding/deploying when it should and it's a bit confusing to have parallel conversations in the same issue.

@DanTup Ok I will open a new issue for this tomorrow but for the time being let me give you the log file which I could generate ( the updated one ) . Also while making this video - https://youtu.be/q-GtMerSNuY , I faced the issue in the end so you can watch the end portion for more understanding . Thanks
flutter_run.txt I don't know if the file hasn't something which you expect but I'm uploading whatever was generated

@iampawan Thanks; that log has it. It actually has what I feared might be in it:

TimeoutException: Request to Dart VM Service timed out: _flutter.listViews({})

Please do open an issue for it; I've seen other reports of it recently too.

@cbracken Did my logs help somehow?

To the original issue on this thread, I can confirm that the hot reload does now look to take into consideration code changes between runs and so does not need a manual 'flutter clean' operation.

However, if switching from a Debug run to a Non-Debug run after a number of change/hot reload operations, that Flutter Clean does still need to be made.

I started experiencing problems with this today (on both an emulator and a real device) on Windows with the hot reload breaking while I was changing around values in flutter's animation tutorial code. (https://flutter.io/tutorials/animation/).

I was able to fix the hot reloading issue by removing the spaces in the directory structure that contained the code. Seems silly, but it worked for me.

E.g. I changed C:\Dev\Flutter Apps\hello_world\animation_examples

to C:\Dev\Flutter_Apps\hello_world\animation_examples

Flutter doctor:

[√] Flutter (Channel dev, v0.5.5, on Microsoft Windows [Version 10.0.17134.112], locale en-AU)
    • Flutter version 0.5.5 at C:\Dev\flutter-sdk
    • Framework revision 020e0ef55c (12 days ago), 2018-06-14 13:17:08 -0700
    • Engine revision c3976b3c71
    • Dart version 2.0.0-dev.61.0.flutter-c95617b19c

[√] Android toolchain - develop for Android devices (Android SDK 27.0.3)
    • Android SDK at C:\Users\Jason\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
    • Flutter plugin version 25.0.1
    • Dart plugin version 173.4700
    • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1024-b02)

[!] VS Code, 64-bit edition (version 1.24.1)
    • VS Code at C:\Program Files\Microsoft VS Code
    • Flutter extension not installed; install from
      https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter

[√] Connected devices (1 available)
    • Android SDK built for x86 • emulator-5554 • android-x86 • Android 8.1.0 (API 27) (emulator)

! Doctor found issues in 1 category.

I was also experiencing this issue on the beta and master branches of Flutter.

I'm also facing the same issues with flutter since last month. Hope Flutter Team considers this issue and fix it soon. Because We love #Flutter.

A lot of the team is out of the office right now but it sounds like the next step here is for @cbracken to review the logs from @escamoteur above.

I have multiple that I'm using to develop flutter apps and I've had this same problem where the app doesn't update even after completely rebuilding the app. I have to do a hot restart for the changes to occur after each time i do flutter run.

Any improvement? the problem still persists. Please fix it. We love

Flutter

I honestly cannot report that I still have problem. Have you tried switching to dev or master channel?

I can confirm the problem. If I change something in my code and start debugging, I'm never sure if I got 'the latest version'. If I debug with step through... I can see it sometimes stepping through code in comments... Now just to be sure, I do a flutter run and try again.

[√] Flutter (Channel master, v0.5.7-pre.62, on Microsoft Windows [Version 10.0.17134.112], locale en-US)
• Flutter version 0.5.7-pre.62 at C:\flutter
• Framework revision 7ac183794b (2 days ago), 2018-07-06 15:21:29 -0700
• Engine revision 6fe748490d
• Dart version 2.0.0-dev.63.0.flutter-4c9689c1d2

[√] Android toolchain - develop for Android devices (Android SDK 27.0.3)
• Android SDK at C:\Android\android-sdk
• Android NDK location not configured (optional; useful for native profiling support)
• Platform android-27, build-tools 27.0.3
• ANDROID_HOME = C:\Android\android-sdk
• Java binary at: C:\Program Files\Android\Android Studio\jrebin\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
• Flutter plugin version 25.0.1
• Dart plugin version 173.4700
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1024-b02)

[√] VS Code, 64-bit edition (version 1.25.0)
• VS Code at C:\Program Files\Microsoft VS Code
• Flutter extension version 2.15.0

So it would be interesting what's the difference on our systems

@gspencergoog I'm told you may be looking at some issues like this; not sure if you'd seen this one?

@DanTup I have seen it, but I think @cbracken is in a better position to fix it.

Can anyone reproduce that explicitly saving before hot-reload/hot-restart
improves the situation? (with hot-reload on save disabled)
See also flutter/flutter-intellij#2472

Only thing I obersved yesterday is that if I make a change to a package file while debugging that is not part of my project I have to hot reload explicitly after saving to take effect

@escamoteur Thanks for the feedback. That sounds like #15879

Nope not chanching the package just make a small code change in a referenced package for debugging

You mean a path dependency?

No a package dependency. But maybe that's too much to expect.

Are you modifying files in ~/.pub-cache/hosted/.... I strongly doubt you'll get any support for that use case. That's strongly discouraged. Otherwise there is no way to get a hosted package code to change without the .packages file to change.

OK I plee guilty 😁

@escamoteur I don't know if it makes a difference here (and you may already know this), but you can override paths for imported packages if you want a "less unsupported" way to modify files in packages:

dependency_overrides:
  vm_service_client:
    path: ../../../vm_service_client

@escamoteur I'd have to look at our hot reload code, but I definitely remember that when pub serve existed (for the web), it was an intentional design decision to watch the app project and the transitive closure of path: dependencies, but not to watch anything in the pub cache (that code is not intended to be user-modifiable), or git dependencies. I'd very much suspect that remains the case with flutter.

@cbracken thanks for clarification. Sorry when I lead a bit away from the original issue

The problem still persists. Any Fixes?? Please throw out some information.

@cbracken This got workt with today version:

Flutter 0.5.8-pre.61 • channel master • https://github.com/flutter/flutter
Framework • revision b8b6d41 (7 hours ago) • 2018-07-17 18:07:54 -0700
Engine • revision 5557e3006e
Tools • Dart 2.0.0-dev.67.0.flutter-84ca27a09e

I was only able to debug changes after Hot reload. Even a Flutter clean didn't help anymore.
I rolled back to git reset --hard e22f99743b4f0bea4a9b8e7703ce5ffbfda37a04
Solved the problem works again now

I'm unsure of the status of this bug. :/

It sounds like the original issue might have been resolved, but then there are related reports which have also been added here?

It sounds like @escamoteur most recent comment suggests that debugging is busted in the latest master, but that seems unrelated to the original issue?

I'd recommend that users still experiencing issues in this space file new, separate bugs (which you're welcome to link to from here) so we can make sure to diagnose and solve each one?

Not really. Debugging works but it just does not always push the latest version of the App to the device when starting a new debug session. All changes done via hot reload are pushed and can be debugged.

@escamoteur would you be willing to file a new bug about that specific issue? I'd be happy to pull in the right folks to make sure we get it fixed. Thanks!

@eseidel ok, but will be tomorrow.

I think the issue @escamoteur is having may be the same as the original report here - stale apps being launched on the device?

I think the statement above was a little confusing because it mentioned debugging but when I asked to clarify on Gitter he said:

I started the app made some changes and did a hot reload => changes appeared. Stopped the App and started new => got old app version

If I understand the original report correctly, I think these may be the same.

@escamoteur, did you file new issue? If so share the link here!

Not yet I have to reproduce it again which means changing my currently working setup and I had to do some real development the last days

Yup, I can confirm I am also facing this issue, I am working from VS Code and was just starting with flutter, and working on the "Startup Name Generator" example app, and was surprised to see that the app on a restart showed an old piece of code, making a change and doing a hot reload, immediately updated the entire UI to the current code, so deduced the apk was never getting updated with the new changes, came here and found that doing a flutter clean resolved my issue temporarily, but this is very much an annoying issue, we need a clean and build option.

Could you please add your Flutter doctor output here so that we know which version you are using?

I used the zip file in the website but it seems I have an upgrade available I will update the status on how it is after upgrade

[flutter] flutter doctor
╔════════════════════════════════════════════════════════════════════════════╗
║ WARNING: your installation of Flutter is 77 days old. ║
║ ║
║ To update to the latest version, run "flutter upgrade". ║
╚════════════════════════════════════════════════════════════════════════════╝

Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel beta, v0.5.1, on Mac OS X 10.12.6 16G1408, locale en-IN)
[✓] Android toolchain - develop for Android devices (Android SDK 28.0.2)
[✓] iOS toolchain - develop for iOS devices (Xcode 9.2)
[✓] Android Studio (version 3.1)
✗ Flutter plugin not installed; this adds Flutter specific functionality.
✗ Dart plugin not installed; this adds Dart specific functionality.
[!] VS Code (version 1.26.0)
[✓] Connected devices (1 available)

! Doctor found issues in 1 category.
exit code 0

Yes please try that. Also you could try to switch to dev or master branch

Well its fixed I suppose, I can disconnect and reconnect and I can see a new build is being properly generated and installed, is there anyway I can ensure a rebuild with all the code at a certain point of time like before I am done with work, because now hot reload is working almost like instant run in Android Studio, the changes apply only as long as the session is connected, on a disconnect and reconnect it does a full build if I run again(is there an easier way to do this for VS Code?)

@droidluv I think there was some work done recently to allow reconnect. Not sure this covers your use case.

Any updates ? Its 2 months. I can't use flutter until this issue resolved.
I run it from vscode.
logs

NoSuchMethodError: The getter 'isClosed' was called on null.
Receiver: null
Tried calling: isClosedNoSuchMethodError: The getter 'isClosed' was called on null.
Receiver: null
Tried calling: isClosedNoSuchMethodError: The getter 'isClosed' was called on null.
Receiver: null
Tried calling: isClosedNoSuchMethodError: The getter 'isClosed' was called on null.
Receiver: null
Tried calling: isClosedNoSuchMethodError: The getter 'isClosed' was called on null.
Receiver: null
Tried calling: isClosedNoSuchMethodError: The getter 'isClosed' was called on null.
Receiver: null
Tried calling: isClosedNoSuchMethodError: The getter 'isClosed' was called on null.
Receiver: null
Tried calling: isClosed

env

~/Desktop/hello_world
$ flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel beta, v0.7.3, on Mac OS X 10.14 18A384a, locale en-CN)
[✓] Android toolchain - develop for Android devices (Android SDK 26.0.2)
[✓] iOS toolchain - develop for iOS devices (Xcode 9.4.1)
[✓] Android Studio (version 3.0)
[✓] VS Code (version 1.27.0)
[✓] Connected devices (1 available)

• No issues found!

@bang88 Try switching to dev or master and give it a try. it works fine for me since quite a while.
How are this error messages connected to this issue?

@escamoteur I have try switch to different channel and have the same error. The original issue was https://github.com/Dart-Code/Dart-Code/issues/1113

@DanTup is there a way to get vscode to run the CLI with --verbose?

@tvolkert yep, click the cog on the Debug Sidebar to create/open launch.json, and then add an args section, so it looks something like this:

{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Flutter",
            "request": "launch",
            "type": "dart",
            "args": [
                "-v"
            ]
        }
    ]
}

The output will appear in the Debug Console:

screen shot 2018-09-07 at 17 33 20

@bang88 can you try enabling verbose logging per the previous comment and paste the output here?

Thanks @bang88!

FYI, for future reference, gist.github.com is a great place to paste really large log snippets like the above. Then you paste a link to the gist in the comments here.

So based on that output, it looks like the following line is returning null:

https://github.com/flutter/flutter/blob/cb74e0eda87e35966437ef38a09ef02e23d50206/packages/flutter_tools/lib/src/resident_runner.dart#L71

Actually, digging a bit, it looks more like a race condition. @bang88 can you try applying the following diff locally and then running again, and include the output? Thanks!

diff --git a/packages/flutter_tools/lib/src/resident_runner.dart b/packages/flutter_tools/lib/src/resident_runner.dart
index d675e6db3..cdfabe409 100644
--- a/packages/flutter_tools/lib/src/resident_runner.dart
+++ b/packages/flutter_tools/lib/src/resident_runner.dart
@@ -86,12 +86,17 @@ class FlutterDevice {
     if (vmServices == null)
       return <FlutterView>[];

-    return vmServices
-      .where((VMService service) => !service.isClosed)
-      .expand((VMService service) => viewFilter != null
-          ? service.vm.allViewsWithName(viewFilter)
-          : service.vm.views)
-      .toList();
+    try {
+      return vmServices
+        .where((VMService service) => !service.isClosed)
+        .expand((VMService service) => viewFilter != null
+            ? service.vm.allViewsWithName(viewFilter)
+            : service.vm.views)
+        .toList();
+    } catch (error) {
+      printError('Error while getting views: $error -- stack trace: ${StackTrace.current}');
+      rethrow;
+    }
   }

   Future<Null> getVMs() async {

@bang88 I deleted your above comment with the inline log content that you also made available with the gist link. I hope it's ok.

@zoechi Thanks.

@bang88 Could you try capturing a log from VS Code while reproducing this and attach here?

In VS Code, run the Dart: Capture Logs command from the command palette and tick the Debugger (Observatory) and Flutter Run categories. Then reproduce the issue and hit Stop Logging, then send us the log.

@bang88 Before you do that, can you please try installing this beta version of Dart Code:

https://github.com/Dart-Code/Dart-Code/releases/tag/v2.18.1-beta.1

It fixes a bug where running with verbose output from Flutter could cause us to attach the debugger earlier than expected (because we incorrectly parse the Observatory URL from the verbose output). This looks like it might be what's happening in your most recent log, though since I think it's caused by verbose logging, it might not be the original issue (though it's suspicious that the error seems to be the same).

@DanTup I have reproduced it as you suggested. here is the new logs https://gist.github.com/bang88/e140e6a9a3c0c045d24339fc593c5595

And I captured an gif:

log

@DanTup it definitely looks like we start sending events after the app.start event and don't wait for the app.started event.

21696 will make the code more defensive on the tools side, but we should probably also update the IDE side to hold off on sending any events until the app has started.

Seems like a timing issue depending on the performance of the dev machine so that some people face it and others don't

Hardware Overview:

  Model Name:   MacBook Pro
  Model Identifier: MacBookPro14,3
  Processor Name:   Intel Core i7
  Processor Speed:  3.1 GHz
  Number of Processors: 1
  Total Number of Cores:    4
  L2 Cache (per Core):  256 KB
  L3 Cache: 8 MB
  Memory:   16 GB
  Boot ROM Version: MBP143.0178.B00
  SMC Version (system): 2.45f0
  Serial Number (system):   xxx
  Hardware UUID:    xxx

@bang88 if you flutter upgrade on the master channel, you'll get the first fix to this. My guess is that it will cause you to get a more direct timeout waiting to start the app, but please give it a try and report back.

@tvolkert I just upgrade to the master channel and no errors appear anymore. but the screen is white. and hot reload does not work too

~/Desktop/hello_world
$ flutter doctor -v[✓] Flutter (Channel master, v0.8.3-pre.36, on Mac OS X 10.14 18A384a, locale en-CN)
    • Flutter version 0.8.3-pre.36 at /Users/bang/flutter
    • Framework revision d02e67e76e (5 hours ago), 2018-09-12 12:11:59 +0200
    • Engine revision 6f459e2f10
    • Dart version 2.1.0-dev.4.0.flutter-05ccfa8502

[✓] Android toolchain - develop for Android devices (Android SDK 26.0.2)
    • Android SDK at /Users/bang/Library/Android/Sdk
    • Android NDK at /Users/bang/Library/Android/Sdk/ndk-bundle
    • Platform android-26, build-tools 26.0.2
    • ANDROID_HOME = /Users/bang/Library/Android/Sdk
    • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-915-b08)
    • All Android licenses accepted.

[✓] iOS toolchain - develop for iOS devices (Xcode 9.4.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 9.4.1, Build version 9F2000
    • ios-deploy 1.9.2
    • CocoaPods version 1.5.0

[✓] Android Studio (version 3.0)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin version 23.2.1
    • Dart plugin version 171.4424
    • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-915-b08)

[✓] VS Code (version 1.27.1)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 2.18.0

[✓] Connected devices (1 available)
    • iPhone X • 3DBD546E-7A81-40E2-AB99-F2843169EC64 • ios • iOS 11.4 (simulator)

• No issues found!

@tvolkert I think that may have been happening before but the beta version linked above should have fixed that. Looking at this log, I can't see anything being sent to stdin after the app.start event (any data sent to stdin should be logged with [FlutterRun] [Info] ==> in the line), but it seems like the last line out of the Flutter process is:

[10:18:14 GMT+0800 (CST)] [FlutterRun] [Info] <== [ +5 ms] Connecting to service protocol: http://127.0.0.1:59843/

Then nothing happens until the debug session was terminated. I think something in Flutter may be stalling after the line above, before the app.started event is sent.

I wonder if we should add additional printTraces between the code that prints the line above and the one that sends the app.started event? There was another issue I commented on earlier about this too (https://github.com/flutter/flutter/issues/18889#issuecomment-420706390) which I think is a different issue, but also seems like something stalling in this area.

If we don't want to commit extra logging, we could do it on a branch and just have these users pull that.

This future is not completing in time (or perhaps never completing):

https://github.com/flutter/flutter/blob/8cf68731e010023e5dcae1f00991f4ac5b1b758b/packages/flutter_tools/lib/src/resident_runner.dart#L71

There are trace statements before and after it -- we're seeing the one before, but not the one after...

VM requests can go unanswered if VM actually went down too.
What is going on on the device when we encounter these hang-ups? Are there any crashes reported on the device?

No crashes just a blank screen https://github.com/flutter/flutter/issues/16604#issuecomment-420490327

Typically I would have to build the application and it would run the application correctly with the changes.

Actually scratch that. I gotta reinstall the application

Any updates?

I don't need flutter clean much anymore since a while.

For me clean does not do anything. I have to delete app from iOS simulator. Then flutter will try to run (and fail). And when if I run it for the second time it works.

There must be something wrong with incremental update logic. If app was deleted or changed via hot reload, it will not be properly detected during flutter run.

I can not use flutter until this problem been solved.

I just encountered this problem on version 0.8.2

It's really annoying.

Switch to dev channel

Still a problem in master 0.10.1-pre.15

I think one of the main reasons this problem happen ( fixed by delete build folder or executes flutter clean command) , when some unvaild modifications applied to the code and then press hot reload or hot restart and then the application crash, after this any new run for the project will take the old build ( before the unvaild modifications) until deleting the build folder.

FYI @gspencergoog this seems to be one of the more oft-reported tooling issues.

@FlutterIODev I agree, crash seems to be necessary to happen for this problem to occur. I think it should be also unrecoverable crash, when app freezes. This seems to happen more when I'm debugging, although I'm not totally sure.

My experience backs that up. I can guarantee hot reload won't work if there is an exception, needing a clean to work again (which, not being mentioned in tutorials, is pretty confusing when you start out). I've even had 'build apk' use reflect a previous debug build rather than the current files if 'clean' wasn't used first - that in particular seems unintended.

Are there any particular types of crashes that seem to correlate? Maybe crashes that happen sooner in the startup sequence, or in a particular plugin? I'm wondering if we are just not recovering properly from some kinds of exceptions.

Just install 0.9.4 minutes ago and its still not working.

Any update I'm having the same problem.

Dear everyone that's been affected by this bug:

We're trying to track down the cause(s) of this bug and having a hard time identifying a smoking gun. If you could please help us by filling out this quick form, it'd greatly help.

https://goo.gl/forms/eFPT6A3jAD8clU4o2

@dedeswim
@ratsey
@escamoteur
@iampawan
@KgotsoK
@jason-codeheroes
@mohith7548
@RedTech64
@jmwatte
@droidluv
@titonton
@szotp
@ElNuru247
@magicleon94
@NotThatBowser
@bang88
@davidgalarza

I haven't seen this bug since quite a while since I'M on dev channel

Folks who are able to reproduce it - when you get into that state(when the app on the device is no longer being updated as you attempt to deploy it from the host), before doing flutter clean would it be possible for you to make some change to the source, do flutter run --verbose and share the output of that via gist.github.com?

when this issue occurs to me, I'm receiving this error from Android Studio

java.io.IOException: error from app.callServiceExtension: "Bad state: No element"
java.util.concurrent.CompletionException: java.io.IOException: error from app.callServiceExtension: "Bad state: No element"
    at java.util.concurrent.CompletableFuture.encodeThrowable(CompletableFuture.java:292)
    at java.util.concurrent.CompletableFuture.completeThrowable(CompletableFuture.java:308)
    at java.util.concurrent.CompletableFuture.uniApply(CompletableFuture.java:593)
    at java.util.concurrent.CompletableFuture$UniApply.tryFire(CompletableFuture.java:577)
    at java.util.concurrent.CompletableFuture.postComplete(CompletableFuture.java:474)
    at java.util.concurrent.CompletableFuture.completeExceptionally(CompletableFuture.java:1977)
    at io.flutter.run.daemon.DaemonApi$Command.completeExceptionally(DaemonApi.java:375)
    at io.flutter.run.daemon.DaemonApi.dispatch(DaemonApi.java:181)
    at io.flutter.run.daemon.DaemonApi$1.onTextAvailable(DaemonApi.java:141)
    at sun.reflect.GeneratedMethodAccessor95.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at com.intellij.execution.process.ProcessHandler$5.invoke(ProcessHandler.java:223)
    at com.sun.proxy.$Proxy17.onTextAvailable(Unknown Source)
    at com.intellij.execution.process.ProcessHandler.notifyTextAvailable(ProcessHandler.java:197)
    at com.intellij.execution.process.BaseOSProcessHandler$SimpleOutputReader.onTextAvailable(BaseOSProcessHandler.java:198)
    at com.intellij.util.io.BaseOutputReader.sendText(BaseOutputReader.java:202)
    at com.intellij.util.io.BaseOutputReader.processInput(BaseOutputReader.java:186)
    at com.intellij.util.io.BaseOutputReader.readAvailableNonBlocking(BaseOutputReader.java:105)
    at com.intellij.util.io.BaseDataReader.readAvailable(BaseDataReader.java:85)
    at com.intellij.util.io.BaseDataReader.doRun(BaseDataReader.java:163)
    at com.intellij.util.io.BaseDataReader$1$1.run(BaseDataReader.java:66)
    at com.intellij.util.ConcurrencyUtil.runUnderThreadName(ConcurrencyUtil.java:209)
    at com.intellij.util.io.BaseDataReader$1.run(BaseDataReader.java:63)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)
Caused by: java.io.IOException: error from app.callServiceExtension: "Bad state: No element"
    ... 22 more

maybe it can help...
```
flutter --version:

Flutter 0.9.4 • channel beta • https://github.com/flutter/flutter.git
Framework • revision f37c235c32 (3 weeks ago) • 2018-09-25 17:45:40 -0400
Engine • revision 74625aed32
Tools • Dart 2.1.0-dev.5.0.flutter-a2eb050044
```
Win10
physical Android device.

Folks who are able to reproduce it - when you get into that state(when the app on the device is no longer being updated as you attempt to deploy it from the host), before doing flutter clean would it be possible for you to make some change to the source, do flutter run --verbose and share the output of that via gist.github.com?

There you go: https://gist.github.com/zoechi/63ad820136130ee6a053e33f48b9ea14

@5ummit did you fill https://goo.gl/forms/eFPT6A3jAD8clU4o2

for Others the suggestion was to post the logs using https://gist.github.com/
and only post the link here to avoid this issue becoming a Mile long.

@5ummit wrote:

There you go:
...
[ +97 ms] [ +578 ms] Skipping kernel compilation. Fingerprint match.

Thanks, very helpful. The fact that we skipped compilation after you modified source seems to be the root cause. We perhaps need to instrument fingerprint calculation more to understand why it reported a match after you edited a source. Just to confirm - you have edited one of the sources in your flutter app in lib/ folder, right?

@5ummit wrote:

There you go:
...
[ +97 ms] [ +578 ms] Skipping kernel compilation. Fingerprint match.

@aam wrote:
Thanks, very helpful. The fact that we skipped compilation after you modified source seems to be the root cause. We perhaps need to instrument fingerprint calculation more to understand why it reported a match after you edited a source. Just to confirm - you have edited one of the sources in your flutter app in lib/ folder, right?

Yeah, plenty - previously I've had an issue which I managed to fix https://github.com/flutter/flutter/issues/23131 thanks to the community. Now receiving this one - think they're connected?

I think for me personally my problem is originating from a Firebase dependency, it happened with https://github.com/flutter/flutter/issues/23131 as well. I'll need to look around to find more though.

To reproduce I do the following.

  • flutter clean
  • flutter run -v
  • Make a change
  • Hot reload change (with r)
  • Stop app (with q)
  • flutter run -v
  • Make another change
  • Hot reload (with r)
  • Stop app (with q)
  • flutter run -v

Only the first change is shown. Must run flutter clean to get the second change to show.
Fyi, I am changing a static const integer that is used in a Text widget

@SUPERETDUPER wrote:

Here : https://gist.github.com/SUPERETDUPER/2b3585956f279ab5e47df431e8eda113
...
Compiling dart to kernel with 439 updated file

This seems to indicate that when you did flutter run -v we did rebuild the app, but what you are saying is that the app ran without your change(static const integer?) being evident?

Are you able to reproduce this on flutter sample counter (flutter create sample) app?

I was using the flutter counter sample app. All I did was add Text("Number: $number") in the column widget. And I added this line static const int number = 1; in MyHomePageState . For changes I just changed 1 to other values.

And yes the app did rebuild; the first time with the changes but the second time without the second change.

@SUPERETDUPER can you please check if creating sample flutter project somewhere _outside_ of a path with space in a name(your working folder full path has space in IntelliJ IDEA) fixes the problem you experience with stale app state?

If this is so hard to fix, then is there at least some flag to force flutter to rebuild on every launch?

If this is so hard to fix, then is there at least some flag to force flutter to rebuild on every launch?

It's not as simple as a flag, but if you're using VS Code you could create a task to run flutter clean and set it as the preLaunchTask.

.vscode/tasks.json

{
    "version": "2.0.0",
    "tasks": [
        {
            "label": "flutter clean",
            "type": "shell",
            "command": "flutter clean"
        }
    ]
}

.vscode/launch.json

{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Flutter",
            "request": "launch",
            "type": "dart",
            "preLaunchTask": "flutter clean"
        }
    ]
}

Further up you said that clean doesn't work for you and you have to uninstall the app from the device. If that's still the case then you'd likely need to change the flutter clean command to an adb command to uninstall the app.

That said, I'd encourage trying the things listed above before doing this!

@DanTup indeed I need to delete the app. It's possible that there are actually two bugs: one about needing to run clean, and one about needing to delete iOS app.

I tested a bit more, and created sample project that works 100% of time, but only on iOS. It's possible that I never had this problem on Android, but I'm not sure.

https://github.com/szotp/flutter_stale_app

I have added detailed instructions on how to achieve the bug:
https://github.com/szotp/flutter_stale_app/blob/master/lib/main.dart#L29-L36

EDIT: I think it's essential here, that app is in this frozen state - debugger breakpoint seems to ensure this in my sample, but it's possible to have frozen app without reaching any breakpoints. Killing app before relaunching seems to help, so that Xcode build runs again.

EDIT: When app is frozen and I launch again, Xcode build does not happen, but app is clearly killed and launched again, losing all hot reloads that were accumulated before.

Interestingly, when I'm debugging with the version that didn't update successfully, the debugger brings up the old code (from the build folder). So it seems like the build folder is not being updated?

@szotp Thanks! I reproduced this first time with your instructions/app on the iOS Simulator on my MacBook.

@aam @tvolkert not sure who's looking at this, but I presume it'll repro easily. If not, feel free to grab me if (remote) access to my machine is useful to debug.

@tvolkert Do you think you can share the results from the google form? I'm curious.

From the description, it sounds like one of the flutter_assets files isn't getting synched correctly in this scenario.

@SUPERETDUPER sure thing! Here it is: survey.pdf. It shows pretty varied responses, which to me says that this bug is probably overloaded with more than one underlying cause.

@sztop, thanks for the awesome repro!
Does https://github.com/flutter/flutter/issues/16604#issuecomment-431066044 happen on iOS simulator only? What if you exit(close) flutter app on iOS simulator before starting it again from VSCode?

@aam Seems like removing the spaces fixed it! Thank you!

With #23268(ios simulator fix) and #23273(spaces in path fix) landed in master branch, please give master channel a try if you can and see if you are still able to reproduce the problem. Thanks!

@aam Now it works, thanks.

I have try flutter channel master and the problem still there. Give up for now 😢 . I created an ubuntu machine and setup a new dev env there and everything works as expected.

@bang88, not sure if you can run flutter from command line, but any chance you can do flutter run --verbose after making a change and share the output of that via gist.github.com?

@aam The logs: https://gist.github.com/bang88/9b2d69d43b2cb95f008a35ae399159b8

and flutter versions

~/Desktop/my_new_app 3m 34s
$ flutter doctor -v
[✓] Flutter (Channel master, v0.10.2-pre.21, on Mac OS X 10.14 18A389, locale
    en-CN)
    • Flutter version 0.10.2-pre.21 at /Users/bang/development/flutter
    • Framework revision 7aeb539da9 (34 hours ago), 2018-10-21 05:47:10 +0200
    • Engine revision 58cdd53f90
    • Dart version 2.1.0-dev.7.1.flutter-b99bcfd309

[✓] Android toolchain - develop for Android devices (Android SDK 27.0.3)
    • Android SDK at /Users/bang/Library/Android/Sdk
    • Android NDK at /Users/bang/Library/Android/Sdk/ndk-bundle
    • Platform android-27, build-tools 27.0.3
    • ANDROID_HOME = /Users/bang/Library/Android/Sdk
    • Java binary at: /Applications/Android
      Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-915-b08)
    • All Android licenses accepted.

[✓] iOS toolchain - develop for iOS devices (Xcode 10.0)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 10.0, Build version 10A255
    • ios-deploy 2.0.0
    • CocoaPods version 1.5.0

[✓] Android Studio (version 3.0)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin version 23.2.1
    • Dart plugin version 171.4424
    • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-915-b08)

[✓] VS Code (version 1.28.2)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 2.19.0

[✓] Connected device (1 available)
    • iPhone X • 57906EE0-7FEB-487A-8698-85E91AF8B004 • ios • iOS 12.0
      (simulator)

• No issues found!

@aam The logs: https://gist.github.com/bang88/9b2d69d43b2cb95f008a35ae399159b8

@bang88 , I'm getting 404 error for this url.

@aam Github is down ?

Can i send you an email with the gists. or waiting Github fixes the server issues

@bang88 , refreshing that link and was able to see the gist, thanks!

What file are you editing (when you do flutter run -v)? Is that one of the dart files in your project or in one of the packages you import? Do you see the file you are editing in build/snapshot_blob.bin.d
Fingerprint match message in the log indicates that we didn't see the change for some reason.

[  +20 ms] Building Runner.app for ...
...
[ +371 ms] Skipping kernel compilation. Fingerprint match.
[ +545 ms] Building bundle

Any news on this issue?
I have had this issue right after I switched from emulator (windows) to a real device (android).
flutter clean deletes .build but I still get the old app. Only after reinstalling the app on the device everything works as expected.

@stannynuytkens What version of flutter are you on? Can you repro from the command line?

If so, could you try following @aam's instructions in the previous few messages?

  • Uninstall the app from phone
  • Delete the build folder
  • Run the app from the console
  • Once loaded, quit the app (with q)
  • Make a change to a file (note which file you change)
  • Run flutter run -verbose

Assuming this repros the problem, providing the output of the final flutter run -verbose in a gist, as well as info on what file you modified may be useful. Also check if the file you modified shows up in build/snapshot_blob.bin.d/

Update: results from the survey are viewable at https://docs.google.com/spreadsheets/d/1xCzx-Xwx0Qiv3U5GqnjwkyLlzVmcxEZ73hzQszyzhkY/preview

There doesn't seem to be any smoking gun 😞

If you're working on dev or master and running into issues frequently, I've added the ability to disable all of our build caching (this won't slow down hot reload or hot restart). This can be done by settings the environment variable DISABLE_FLUTTER_BUILD_CACHE=true.

If this improves/doesn't improve the situation I would love to know, but keep in mind this will only take effect in v1.5.3 and above.

We've confirmed that this fixes the case of stale assets referenced in #27720 and similar bugs. To proceed here, we're going to disable build caching by default. These build caches will be individually re-enabled once we have better integration test coverage to prove correctness.

This change will likely not be a stable release for some time, and ideally by the time the next stable release is available we will have turned all build caching back on. In the meantime, if users that are on dev or master could report whether or not they still see this issue it would be extremely helpful in shaking out all of the loose ends.

I am having this issue and so is my colleague. We've had this problem for more than a week now.

Every time I run the app in an iOS simulator an old version of the code is run. If I hot restart the latest code is run. Flutter clean does not change anything. I get the same problem on every simulator I've tried and regardless of whether I run from Android Studio, the terminal or XCode. I haven't tried running from another IDE.

flutter doctor -v output:
[✓] Flutter (Channel stable, v1.2.1, on Mac OS X 10.14.4 18E226, locale en-SE)
• Flutter version 1.2.1 at /Users/martinlundberg/Dev/flutter
• Framework revision 8661d8aecd (2 months ago), 2019-02-14 19:19:53 -0800
• Engine revision 3757390fa4
• Dart version 2.1.2 (build 2.1.2-dev.0.0 0a7dcf17eb)

[✓] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
• Android SDK at /Users/martinlundberg/Library/Android/sdk
• Android NDK location not configured (optional; useful for native profiling support)
• Platform android-28, build-tools 28.0.3
• Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1248-b01)
• All Android licenses accepted.

[✓] iOS toolchain - develop for iOS devices (Xcode 10.2.1)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 10.2.1, Build version 10E1001
• ios-deploy 1.9.4
• CocoaPods version 1.5.3

[✓] Android Studio (version 3.3)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin version 33.3.1
• Dart plugin version 182.5215
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1248-b01)

[✓] IntelliJ IDEA Ultimate Edition (version 2018.1.3)
• IntelliJ at /Applications/IntelliJ IDEA.app
• Flutter plugin version 29.0.2
• Dart plugin version 181.4892.1

[✓] IntelliJ IDEA Community Edition (version 2018.1.6)
• IntelliJ at /Applications/IntelliJ IDEA CE.app
• Flutter plugin version 29.0.2
• Dart plugin version 181.5540.11

[✓] VS Code (version 1.33.1)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 2.25.1

[✓] Connected device (2 available)
• Android SDK built for x86 • emulator-5554 • android-x86 • Android 9 (API 28) (emulator)
• iPhone 6 • 63E1705F-F8E7-4916-8C58-D2307D217DCD • ios • com.apple.CoreSimulator.SimRuntime.iOS-12-2 (simulator)

• No issues found!

These fixes are only in ~ 1.5 and later so I would expect there to still be issues in 1.2.1. I'm surprised that flutter clean has no effect though - in this case I would try restarting the simulator.

Yeah it surprises me too.

Restarting the simulator changes nothing unfortunately. The only way to fix it is to hot restart; that makes the latest code run. The problem is that that doesn't change the environment settings we set up before runApp :/

So do you recommend to change to ~1.5 to fix the issue?

Do you have a differently configured build directory? Specifically if foo/ is the root of your flutter project is there a foo/build directory? If so can you manually delete that and try again?

Also, it appears that the fix I landed was tagged as v1.5.8

Yeah flutter clean deletes the build folder and then I get the same problem when I build and run again.

@molundb wrote

I am having this issue and so is my colleague. We've had this problem for more than a week now.

Do you know when did it start? Did you run older version of flutter before that or something else changed a week ago?

Every time I run the app in an iOS simulator an old version of the code is run. I

Does it only happen for iOS simulator? Or you are also experiencing this on physical iOS device or Android sim/device?

Are you able to reproduce this when running from command line flutter run -v? If so, can you copy'n'paste flutter run -v output to https://gist.github.com/ and post a link to that here? Basically if you can clean build folder, flutter run -v the app, make a change, do hot reload, confirm no changes showed up, the log for that would be very helpful.

@molundb
Deleting the app from the simulator worked for me. This usually happens when I hit an uncaught exception

@titonton
Thanks for the tip but I have done Hardware -> Erase all Content and Settings... for the simulator and still have the same problem.

@aam

Do you know when did it start? Did you run older version of flutter before that or something else changed a week ago?

It was so long ago that I can't say when it started happening or what caused it unfortunately. I have updated flutter at least once after it started happening.

Does it only happen for iOS simulator? Or you are also experiencing this on physical iOS device or Android sim/device?

It doesn't happen on android sim or device. I am charging an iOS device now to test it.

Basically if you can clean build folder, flutter run -v the app, make a change, do hot reload, confirm no changes showed up, the log for that would be very helpful.

https://gist.github.com/molundb/cda4caa4e90288568db16ba9a0e962d6

Can't answer your question right now about iOS device since it seems like I can't run on this iOS device for some reason:

Launching lib/main_dev.dart on Iphone 7s iPhone in debug mode...
Automatically signing iOS for device deployment using specified development team in Xcode project: 2NJ74JJ92A
Running Xcode build...
Xcode build done. 6.9s
Failed to build iOS app
Error output from Xcode build:

* BUILD FAILED *

Xcode's output:

=== BUILD TARGET Runner OF PROJECT Runner WITH CONFIGURATION Debug ===
The use of Swift 3 @objc inference in Swift 4 mode is deprecated. Please address deprecated @objc inference warnings, test your code with “Use of deprecated Swift 3 @objc inference” logging enabled, and then disable inference by changing the "Swift 3 @objc Inference" build setting to "Default" for the "Runner" target.
=== BUILD TARGET Runner OF PROJECT Runner WITH CONFIGURATION Debug ===
ld: warning: ignoring file /Users/martinlundberg/AndroidStudioProjects/tlycs_flutter/ios/Flutter/App.framework/App, file was built for x86_64 which is not the architecture being linked (arm64): /Users/martinlundberg/AndroidStudioProjects/tlycs_flutter/ios/Flutter/App.framework/App
=== BUILD TARGET Runner OF PROJECT Runner WITH CONFIGURATION Debug ===
Non-fat binary /Users/martinlundberg/AndroidStudioProjects/tlycs_flutter/build/ios/Debug-iphoneos/Runner.app/Frameworks/App.framework/App is not arm64. Running lipo -info:
Non-fat file: /Users/martinlundberg/AndroidStudioProjects/tlycs_flutter/build/ios/Debug-iphoneos/Runner.app/Frameworks/App.framework/App is architecture: x86_64
Command /bin/sh failed with exit code 1

Could not build the precompiled application for the device.

Error launching application on Iphone 7s iPhone.

@molundb wrote

Basically if you can clean build folder, flutter run -v the app, make a change, do hot reload, confirm no changes showed up, the log for that would be very helpful.
https://gist.github.com/molundb/cda4caa4e90288568db16ba9a0e962d6

Thanks! So hot reload/restart works as expected, but then when you stop the app and run it again, you see old app shown? Can you please post a gist of flutter run -v of that(second flutter run -v that shows stale app)?

I have the same problem and my productivity is basically 30% of normal because of that. I see that at least 3 to 4 weeks no evidence of any changes to the better. I can only hope somebody makes that a real high priority. - It's killing me right now!!!

A normal turnaround now looks like.

  1. delete all the breakpoints
  2. call flutter clean
  3. cold restart
  4. enable breakpoint again
  5. work a bit

I se also tons of these console messages:
'''16:07:17.994 289 info flutter.tools [ ] -> org-dartlang-debug:synthetic_debug_expression:1:1: Error: Method not found: 'toStringDeep'.
16:07:17.994 290 info flutter.tools [ ] -> toStringDeep()
'''
data output in my console.

Here is my version which is latest on master:

C:\Projects\obdchk>flutter doctor -v
[√] Flutter (Channel master, v1.5.9-pre.62, on Microsoft Windows [Version 10.0.17763.437], locale en-US)
• Flutter version 1.5.9-pre.62 at c:\sdks\flutter
• Framework revision 8fd7fa492a (3 hours ago), 2019-04-29 12:59:30 -0700
• Engine revision 1ecf924ff8
• Dart version 2.3.0 (build 2.3.0-dev.0.3 c46deebfb6)

16:07:17.942 252 info flutter.tools [ +965 ms] -> result 16e00721-c286-43e9-9460-70182643e449
16:07:17.944 253 info flutter.tools [ ] -> org-dartlang-debug:synthetic_debug_expression:1:1: Error: Getter not found: 'snapshot'.
16:07:17.944 254 info flutter.tools [ ] -> snapshot.data
16:07:17.944 255 info flutter.tools [ ] -> ^^^^^^^^
16:07:17.944 256 info flutter.tools [ ] -> org-dartlang-debug:synthetic_debug_expression:1:1: Error: The getter 'snapshot' isn't defined for the class '_HomeScreenState'.
16:07:17.944 257 info flutter.tools [ ] -> - '_HomeScreenState' is from 'package:obdchk/screens/home_screen.dart' ('lib/screens/home_screen.dart').
16:07:17.944 258 info flutter.tools [ ] -> Try correcting the name to the name of an existing getter, or defining a getter or field named 'snapshot'.
16:07:17.944 259 info flutter.tools [ ] -> snapshot.data
16:07:17.944 260 info flutter.tools [ ] -> ^^^^^^^^
16:07:17.952 261 info flutter.tools [ +3 ms] -> 16e00721-c286-43e9-9460-70182643e449 build\app.dill.track.dill.incremental.dill 16
16:07:17.952 262 info flutter.tools [ +2 ms] -> result 1bae7b85-0d7d-48c6-a4c2-e199a261f77e
16:07:17.954 263 info flutter.tools [ +3 ms] -> 1bae7b85-0d7d-48c6-a4c2-e199a261f77e build\app.dill.track.dill.incremental.dill 16
16:07:17.955 264 info flutter.tools [ +2 ms] -> result 853ea583-b3e8-47a7-ae8f-6921d5f98593
16:07:17.963 265 info flutter.tools [ +2 ms] -> 853ea583-b3e8-47a7-ae8f-6921d5f98593 build\app.dill.track.dill.incremental.dill 16
16:07:17.963 266 info flutter.tools [ +1 ms] -> result d79513ca-38d5-4354-a47f-88ddd91741fb
16:07:17.963 267 info flutter.tools [ +3 ms] -> d79513ca-38d5-4354-a47f-88ddd91741fb build\app.dill.track.dill.incremental.dill 16
16:07:17.971 268 info flutter.tools [ +4 ms] -> result 2adf58bf-63cc-4eb8-b6c4-4952c2262bc3
16:07:17.971 269 info flutter.tools [ +2 ms] -> org-dartlang-debug:synthetic_debug_expression:1:1: Error: Getter not found: '_value'.
16:07:17.971 270 info flutter.tools [ ] -> _value
16:07:17.971 271 info flutter.tools [ ] -> ^^^^^^
16:07:17.971 272 info flutter.tools [ ] -> org-dartlang-debug:synthetic_debug_expression:1:1: Error: The getter '_value' isn't defined for the class '_HomeScreenState'.
16:07:17.971 273 info flutter.tools [ ] -> - '_HomeScreenState' is from 'package:obdchk/screens/home_screen.dart' ('lib/screens/home_screen.dart').
16:07:17.971 274 info flutter.tools [ ] -> Try correcting the name to the name of an existing getter, or defining a getter or field named '_value'.
16:07:17.971 275 info flutter.tools [ ] -> _value
16:07:17.971 276 info flutter.tools [ ] -> ^^^^^^
16:07:17.985 277 info flutter.tools [ +8 ms] -> 2adf58bf-63cc-4eb8-b6c4-4952c2262bc3 build\app.dill.track.dill.incremental.dill 18
16:07:17.985 278 info flutter.tools [ +4 ms] -> result 4379cbc9-98a6-4540-865a-c6c0a09aba5e
16:07:17.987 279 info flutter.tools [ +2 ms] -> org-dartlang-debug:synthetic_debug_expression:1:1: Error: Getter not found: 'newValue'.
16:07:17.987 280 info flutter.tools [ ] -> newValue
16:07:17.987 281 info flutter.tools [ ] -> ^^^^^^^^
16:07:17.987 282 info flutter.tools [ ] -> org-dartlang-debug:synthetic_debug_expression:1:1: Error: The getter 'newValue' isn't defined for the class '_HomeScreenState'.
16:07:17.987 283 info flutter.tools [ ] -> - '_HomeScreenState' is from 'package:obdchk/screens/home_screen.dart' ('lib/screens/home_screen.dart').
16:07:17.987 284 info flutter.tools [ ] -> Try correcting the name to the name of an existing getter, or defining a getter or field named 'newValue'.
16:07:17.987 285 info flutter.tools [ ] -> newValue
16:07:17.987 286 info flutter.tools [ ] -> ^^^^^^^^
16:07:17.994 287 info flutter.tools [ +3 ms] -> 4379cbc9-98a6-4540-865a-c6c0a09aba5e build\app.dill.track.dill.incremental.dill 20
16:07:17.994 288 info flutter.tools [ +1 ms] -> result 16915064-96cf-4c0c-9277-a36139fb4487
16:07:17.994 289 info flutter.tools [ ] -> org-dartlang-debug:synthetic_debug_expression:1:1: Error: Method not found: 'toStringDeep'.
16:07:17.994 290 info flutter.tools [ ] -> toStringDeep()
16:07:17.994 291 info flutter.tools [ ] -> ^^^^^^^^^^^^
16:07:17.994 292 info flutter.tools [ ] -> org-dartlang-debug:synthetic_debug_expression:1:1: Error: The method 'toStringDeep' isn't defined for the class 'StreamValue'.
16:07:17.995 293 info flutter.tools [ ] -> - 'StreamValue' is from 'package:utilities/stream/stream_value.dart' ('utilities/lib/stream/stream_value.dart').
16:07:17.995 294 info flutter.tools [ ] -> Try correcting the name to the name of an existing method, or defining a method named 'toStringDeep'.
16:07:17.995 295 info flutter.tools [ ] -> toStringDeep()
16:07:17.995 296 info flutter.tools [ ] -> ^^^^^^^^^^^^
16:07:18.003 297 info flutter.tools [ +4 ms] -> 16915064-96cf-4c0c-9277-a36139fb4487 build\app.dill.track.dill.incremental.dill 22
16:07:18.017 298 info flutter.tools [ +15 ms] -> result 098efd6c-f435-42a8-8ed5-cc3e79a5562f
16:07:18.017 299 info flutter.tools [ ] -> org-dartlang-debug:synthetic_debug_expression:1:1: Error: Method not found: 'toStringDeep'.
16:07:18.017 300 info flutter.tools [ ] -> toStringDeep()
16:07:18.017 301 info flutter.tools [ ] -> ^^^^^^^^^^^^
16:07:18.017 302 info flutter.tools [ ] -> org-dartlang-debug:synthetic_debug_expression:1:1: Error: The method 'toStringDeep' isn't defined for the class '_HomeScreenState'.
16:07:18.017 303 info flutter.tools [ ] -> - '_HomeScreenState' is from 'package:obdchk/screens/home_screen.dart' ('lib/screens/home_screen.dart').
16:07:18.017 304 info flutter.tools [ ] -> Try correcting the name to the name of an existing method, or defining a method named 'toStringDeep'.
16:07:18.017 305 info flutter.tools [ ] -> toStringDeep()
16:07:18.017 306 info flutter.tools [ ] -> ^^^^^^^^^^^^
16:07:18.025 307 info flutter.tools [ +3 ms] -> 098efd6c-f435-42a8-8ed5-cc3e79a5562f build\app.dill.track.dill.incremental.dill 24
16:07:18.032 308 info flutter.tools [ +11 ms] -> result da8399f4-db8d-4390-956d-107016a6ea59
16:07:18.040 309 info flutter.tools [ +6 ms] -> da8399f4-db8d-4390-956d-107016a6ea59 build\app.dill.track.dill.incremental.dill 24
16:07:18.040 310 info flutter.tools [ +1 ms] -> result 542a3647-5840-4c9b-9588-d9f441879e12
16:07:18.040 311 info flutter.tools [ ] -> org-dartlang-debug:synthetic_debug_expression:1:1: Error: Method not found: 'toStringDeep'.
16:07:18.040 312 info flutter.tools [ ] -> toStringDeep()
16:07:18.040 313 info flutter.tools [ ] -> ^^^^^^^^^^^^
16:07:18.040 314 info flutter.tools [ ] -> org-dartlang-debug:synthetic_debug_expression:1:1: Error: The method 'toStringDeep' isn't defined for the class '_StateLifecycle'.
16:07:18.040 315 info flutter.tools [ ] -> - '_StateLifecycle' is from 'package:flutter/src/widgets/framework.dart' ('file:///c:/sdks/flutter/packages/flutter/lib/src/widgets/framework.dart').
16:07:18.040 316 info flutter.tools [ ] -> Try correcting the name to the name of an existing method, or defining a method named 'toStringDeep'.
16:07:18.040 317 info flutter.tools [ ] -> toStringDeep()
16:07:18.040 318 info flutter.tools [ ] -> ^^^^^^^^^^^^
16:07:18.047 319 info flutter.tools [ +3 ms] -> 542a3647-5840-4c9b-9588-d9f441879e12 build\app.dill.track.dill.incremental.dill 26
16:07:18.048 320 info flutter.tools [ +1 ms] -> result 62d95968-c129-4d39-a840-8bdeabef1218
16:07:18.056 321 info flutter.tools [ +6 ms] -> 62d95968-c129-4d39-a840-8bdeabef1218 build\app.dill.track.dill.incremental.dill 26
16:07:18.066 322 info flutter.tools [ +2 ms] -> result b5818d24-c116-4f43-a769-59904f0120de
16:07:18.066 323 info flutter.tools [ ] -> org-dartlang-debug:synthetic_debug_expression:1:1: Error: Method not found: 'toStringDeep'.
16:07:18.066 324 info flutter.tools [ ] -> toStringDeep()
16:07:18.066 325 info flutter.tools [ ] -> ^^^^^^^^^^^^
16:07:18.066 326 info flutter.tools [ ] -> org-dartlang-debug:synthetic_debug_expression:1:1: Error: The method 'toStringDeep' isn't defined for the class 'AppBloc'.
16:07:18.067 327 info flutter.tools [ ] -> - 'AppBloc' is from 'package:elm_bluetooth_bloc/bloc/app_bloc.dart' ('elm_bluetooth_bloc/lib/bloc/app_bloc.dart').
16:07:18.067 328 info flutter.tools [ ] -> Try correcting the name to the name of an existing method, or defining a method named 'toStringDeep'.
16:07:18.067 329 info flutter.tools [ ] -> toStringDeep()
16:07:18.067 330 info flutter.tools [ ] -> ^^^^^^^^^^^^
16:07:18.067 331 info flutter.tools [ +2 ms] -> b5818d24-c116-4f43-a769-59904f0120de build\app.dill.track.dill.incremental.dill 28
16:07:18.179 332 info runtime.gc collection time 229ms • 46.5MB used of 54.7MB • isolates/867114562
16:07:18.250 333 info runtime.gc collection time 235ms • 51.5MB used of 54.7MB • isolates/867114562
16:07:31.262 334 info flutter.tools [+13198 ms] -> result 00e09141-41b9-43e3-806d-d4725fedf81e
16:07:31.262 335 info flutter.tools [ +2 ms] -> org-dartlang-debug:synthetic_debug_expression:1:18: Error: Expected an identifier, but got ''.
16:07:31.262 336 info flutter.tools [ ] -> onData != null &&
16:07:31.262 337 info flutter.tools [ ] -> ^...
16:07:31.270 338 info flutter.tools [ +6 ms] -> 00e09141-41b9-43e3-806d-d4725fedf81e build\app.dill.track.dill.incremental.dill 29
16:07:33.060 339 info flutter.tools [+1792 ms] -> result a180ce8f-8940-46e2-b814-0e24d138f935
16:07:33.067 340 info flutter.tools [ +2 ms] -> a180ce8f-8940-46e2-b814-0e24d138f935 build\app.dill.track.dill.incremental.dill 29
16:07:38.919 341 info flutter.tools [+5854 ms] -> result 95d4434d-929d-4504-8653-b98921661dd8
16:07:38.926 342 info flutter.tools [ +5 ms] -> 95d4434d-929d-4504-8653-b98921661dd8 build\app.dill.track.dill.incremental.dill 29
16:07:38.938 343 info flutter.tools [ +14 ms] -> result b183ab8e-99a6-4db0-be44-310e20c62eac
16:07:38.938 344 info flutter.tools [ +1 ms] -> org-dartlang-debug:synthetic_debug_expression:1:1: Error: Method not found: 'toStringDeep'.
16:07:38.938 345 info flutter.tools [ ] -> toStringDeep()
16:07:38.938 346 info flutter.tools [ ] -> ^^^^^^^^^^^^
16:07:38.938 347 info flutter.tools [ ] -> org-dartlang-debug:synthetic_debug_expression:1:1: Error: The method 'toStringDeep' isn't defined for the class '_Closure'.
16:07:38.938 348 info flutter.tools [ ] -> - '_Closure' is from 'dart:core'.
16:07:38.938 349 info flutter.tools [ ] -> Try correcting the name to the name of an existing method, or defining a method named 'toStringDeep'.
16:07:38.938 350 info flutter.tools [ ] -> toStringDeep()
16:07:38.938 351 info flutter.tools [ ] -> ^^^^^^^^^^^^
16:07:38.946 352 info flutter.tools [ +3 ms] -> b183ab8e-99a6-4db0-be44-310e20c62eac build\app.dill.track.dill.incremental.dill 31
16:07:42.213 353 info flutter.tools [+3268 ms] I/flutter (16546): 26 2019-04-29 16:06:34.931965 FINE ui.main.dart: initial route = null
16:07:42.232 354 info runtime.gc collection time 250ms • 53.1MB used of 60.0MB • isolates/867114562
16:07:42.239 355 info flutter.tools [ +25 ms] I/flutter (16546): 27 2019-04-29 16:06:34.957641 FINE home_screen.dart: build Home Screen
16:07:42.355 356 info flutter.tools [ +114 ms] I/flutter (16546): 28 2019-04-29 16:06:35.071358 FINE ui.main.dart: initial route = null
16:07:42.421 357 info flutter.tools [ +65 ms] I/flutter (16546): 29 2019-04-29 16:06:35.136896 FINE home_screen.dart: build Home Screen
16:07:42.496 358 info runtime.gc collection time 256ms • 54.5MB used of 62.7MB • isolates/867114562
16:07:42.787 359 info runtime.gc collection time 323ms • 41.6MB used of 52.5MB • isolates/867114562
16:08:17.778 360 info flutter.tools [+35360 ms] DevFS: Deleting filesystem on the device (file:///data/user/0/com.cobd.obdchk/code_cache/obdchkUCQMHL/obdchk/)
16:08:17.778 361 info flutter.tools [ ] Sending to VM service: _deleteDevFS({fsName: obdchk})
16:08:17.827 362 info flutter.tools [ +46 ms] Result: {type: Success}
16:08:17.827 363 info flutter.tools [ ] DevFS: Deleted filesystem on the device (file:///data/user/0/com.cobd.obdchk/code_cache/obdchkUCQMHL/obdchk/)
16:08:17.827 364 info flutter.tools [ +1 ms] Sending to VM service: ext.flutter.exit({isolateId: isolates/867114562})
16:08:18.194 365 info flutter.tools [ +363 ms] Service protocol connection closed.
16:08:19.832 366 info flutter.tools [+1639 ms] Application finished.
16:08:19.841 367 info flutter.tools [ +7 ms] "flutter run" took 4,203,976ms.
16:08:19.841 368 info flutter.tools [ ] "flutter run" took 4,203,976ms.

@ride4sun wrote

I have the same problem

Just to confirm - you are able to hot-reload/hot-restart app and see the changes, but as soon as you stop the app and start it again, you don't see the changes? If you can post log(gist) of flutter run -v issued from the command line window once the app gets in this state that should help.

I se also tons of these console messages:
'''16:07:17.994 289 info flutter.tools [ ] -> org-dartlang-debug:synthetic_debug_expression:1:1: Error: Method not found: 'toStringDeep'.
16:07:17.994 290 info flutter.tools [ ] -> toStringDeep()
'''

What IDE do you use? You seem to be running flutter/ide in verbose mode which dumps all on-demand compilation expression requests that IDE issues to evaluate various expressions as you navigate through your source code. Verbose mode being so verbose is as expected, not sure why it is turned on in your configuration though.

Just to confirm - you are able to hot-reload/hot-restart app and see the changes, but as soon as you stop
the app and start it again, you don't see the changes?

I think that is correct - I have to pay more attention to that

If you can post log(gist) of flutter run -v issued from > the command line window once the app gets in > this state that should help.

ok - will do

What IDE do you use?

Android Studio

You seem to be running flutter/ide in verbose mode which dumps all on-demand
compilation expression requests that IDE issues to evaluate various expressions as you navigate through >your source code. Verbose mode being so verbose is as expected, not sure why it is turned on in your >configuration though.

I switched the verbose on after I seen all these problems. I think there is a correlation between when these 'toStringDeep' messages show up.

                                                             toStringDeep()

16:07:38.938 346 info flutter.tools [ ] -> ^^^^^^^^^^^^

@aam

Thanks! So hot reload/restart works as expected, but then when you stop the app and run it again, you see old app shown? Can you please post a gist of flutter run -v of that(second flutter run -v that shows stale app)?

Whenever I start the app old code runs. Hot reloading changes nothing. The only way that I've found to get the current code to run is to hot restart. After that hot reloading works as usual. If I stop and start the app again the old code runs again.

https://gist.github.com/molundb/7020ff1e43e28fd3e2d0326cd0b957ae

@molundb wrote

Whenever I start the app old code runs

What happens if before starting the app you edit some file? What if you delete the app from simulator before starting it again?

I think it be easier to troubleshoot the problem if you also move up to the latest beta or dev.

Also if you could see whether sample (flutter gallery) exhibits same problem as you edit and reload it, stop and start it, ideally from command line where you can capture logs.

@aam wrote

What happens if before starting the app you edit some file?

Tried it, no difference. The same old code still runs.

What if you delete the app from simulator before starting it again?

Tried it, no difference. The same old code still runs.

I think it be easier to troubleshoot the problem if you also move up to the latest beta or dev.

Ok, I changed to beta.

Also if you could see whether sample (flutter gallery) exhibits same problem as you edit and reload it, stop and start it, ideally from command line where you can capture logs.

Running the flutter gallery app worked as it should; no old code was being run.
https://gist.github.com/molundb/075ba9d05e0516b7787a0570a97d05ef

@molundb wrote

What happens if before starting the app you edit some file?

Tried it, no difference. The same old code still runs.

Can you post a log of a run after some source code change? If there is Skipping kernel compilation. Fingerprint match. in the log on initial application launch even if you edit the source code, somehow filesystem then doesn't report file system changes or flutter and you are looking at different sources. Can you confirm that the file that you edit has updated timestamp? beta/dev version should report list of sources it used for compilation - can you confirm that file you edit is listed there?
What if you do flutter clean (or remove build/ folder) - next time you run the app, does it have the changes? If it does, how do you get into broken state? You stop the app, change the source, start the app and don't see the change at that point?

Running the flutter gallery app worked as it should; no old code was being run.

Okay, that at least establishes some reasonable base. Perhaps comparing your application setup on your machine against flutter gallery example could provide some insights as to why it doesn't work for your app? Are both hosted on the same disk/filesystem?

Skipping kernel compilation. Fingerprint match

That should never show up if you're passed this fix, because I've disabled all of the fingerprinters

@aam

Can you post a log of a run after some source code change? If there is Skipping kernel compilation. Fingerprint match. in the log on initial application launch even if you edit the source code, somehow filesystem then doesn't report file system changes or flutter and you are looking at different sources.

I could not find a Skipping kernel compilation. Fingerprint match.

Can you confirm that the file that you edit has updated timestamp? beta/dev version should report list of sources it used for compilation - can you confirm that file you edit is listed there?

Where can I see this timestamp? In the output I can see the file I edited listed two times, but a lot of other files that weren't edited are also listed.

I edited this file: /Users/martinlundberg/AndroidStudioProjects/tlycs_flutter/lib/screens/settings_page/SettingsPage.dart

Here is the output:
https://gist.github.com/molundb/146a46aa7c2e1a6fc81071b4d23561d1

What if you do flutter clean (or remove build/ folder) - next time you run the app, does it have the changes? If it does, how do you get into broken state? You stop the app, change the source, start the app and don't see the change at that point?

No, flutter clean changes nothing. The old code is still run. We get into broken state whenever the app is stopped and then run. Doing a hot restart fixes the broken state.

Okay, that at least establishes some reasonable base. Perhaps comparing your application setup on your machine against flutter gallery example could provide some insights as to why it doesn't work for your app? Are both hosted on the same disk/filesystem?

Yes, they are both hosted on the same disk. I don't know what other differences to look at,
do you have any ideas?

Where can I see this timestamp? In the output I can see the file I edited listed two times, but a lot of other files that weren't edited are also listed.

I mean timestamp you get in ls -al {filename} Terminal Shell for example.
List of files is useful to confirm that the file you are editing is the one that is being compiled.

No, flutter clean changes nothing. The old code is still run. We get into broken state whenever the app is stopped and then run. Doing a hot restart fixes the broken state.

So you start app in state A(let's say background color is grey) - you do flutter run -v. You edit the flutter source code(state B) (so the background color is red for example), you hot-reload('r' in flutter command line terminal session), do you see the change? You stop the app (quit flutter run) and restart it(flutter run -v, do you see state A or state B? If you still see A, what if you remove the app from iphone simulator, do flutter clean, do flutter run again? Still A?

@aam

I mean timestamp you get in ls -al {filename} Terminal Shell for example.
List of files is useful to confirm that the file you are editing is the one that is being compiled.

Oh! I didn't know about that command before. I tried it and it indeed seems to notice when a file is updated. The issue is still the same, however; old code is being run unless I hot restart. Here is the output from the terminal:

Sebastians-MacBook-Pro-Retina-2016:tlycs_flutter martinlundberg$ ls -al lib/widgets/FeedbackButton.dart 
-rw-r--r--  1 martinlundberg  staff  1051 May  6 09:33 lib/widgets/FeedbackButton.dart
Sebastians-MacBook-Pro-Retina-2016:tlycs_flutter martinlundberg$ ls -al lib/widgets/FeedbackButton.dart 
-rw-r--r--  1 martinlundberg  staff  1053 May  7 11:00 lib/widgets/FeedbackButton.dart

So you start app in state A(let's say background color is grey) - you do flutter run -v.

Done.

You edit the flutter source code(state B) (so the background color is red for example), you hot-reload('r' in flutter command line terminal session), do you see the change?

No change.

You stop the app (quit flutter run) and restart it(flutter run -v, do you see state A or state B?

A.

If you still see A, what if you remove the app from iphone simulator, do flutter clean, do flutter run again? Still A?

Interestingly, this time, after running the last flutter run -v, the app crashed and didn't build. Then I tried to run it again without changing anything and it built state A again. Then I hot reloaded, still A. Then I hot restarted, and got state B. Check out the output of everything here:

https://gist.github.com/molundb/ddfd07e7fd1691f8b3992c207b7ac80f

Thanks a lot for all your help so far, this issue is still a major problem for us here.

@molundb wrote

If you still see A, what if you remove the app from iphone simulator, do flutter clean, do flutter run again? Still A?

Interestingly, this time, after running the last flutter run -v, the app crashed and didn't build. Then I tried to run it again without changing anything and it built state A again. Then I hot reloaded, still A. Then I hot restarted, and got state B. Check out the output of everything here:

So it sounds like you are permanently stuck in state A, is that right? There is no change that you can make to the app that takes effect unless you start in state A, then hot-restart the app, but those changes disappear after you stop the app. It sounds like xcodeproject setup issue. Would it be possible for you to create new flutter project via flutter create myproject, then copy your flutter/dart code over into that myproject and see if things are work in myproject?

@aam @molundb it's been a while since it's been used, so it may have gone stale, but it's possible that flutter run --bug-report would prove useful here. You'd have to quit the app pretty quickly to keep the bug report zip file to a somewhat sane size 😄

@aam

So it sounds like you are permanently stuck in state A, is that right? There is no change that you can make to the app that takes effect unless you start in state A, then hot-restart the app, but those changes disappear after you stop the app.

Exactly.

It sounds like xcodeproject setup issue. Would it be possible for you to create new flutter project via flutter create myproject, then copy your flutter/dart code over into that myproject and see if things are work in myproject?

Ok, first I created a new project and then I copied lib, assets, pubspec.yaml, pubspec.lock, package-lock.json and GoogleService-Info.plist into the project. Then whenever I tried to run I got this error which I wasn't able to solve:

5.20.0 - [Firebase/Core][I-COR000004] App with name __FIRAPP_DEFAULT does not exist.
Configuring the default Firebase app...
5.20.0 - [Firebase/Core][I-COR000012] Could not locate configuration file: 'GoogleService-Info.plist'.
5.20.0 - [Firebase/Core][I-COR000005] No app has been configured yet.
5.20.0 - [Firebase/Core][I-COR000005] No app has been configured yet.
*** First throw call stack:
(
    0   CoreFoundation                      0x00000001116846fb __exceptionPreprocess + 331
    1   libobjc.A.dylib                     0x0000000110c28ac5 objc_exception_throw + 48
    2   CoreFoundation                      0x0000000111684555 +[NSException raise:format:] + 197
    3   Runner                              0x000000010a44b462 +[FIRApp configure] + 562
    4   Runner                              0x000000010aa2bf16 -[FLTCloudFirestorePlugin init] + 214
    5   Runner                              0x000000010aa2bda9 +[FLTCloudFirestorePlugin registerWithRegistrar:] + 297
    6   Runner                              0x000000010a2a9123 +[GeneratedPluginRegistrant registerWithRegistry:] + 115
    7   Runner                        <…>

Then I copied the ios folder into the new project and it built, but I got the bug again. Always state A except if I hot restarted. Any idea how I could solve the bug above?

@tvolkert

I ran flutter run --bug-report on the original project and got two zip files? I'm not sure why there are two. Here they are:
bugreport_01.zip
bugreport_02.zip

@aam

I re-did the first try and was able to not get the __FIREAPP_DEFAULT problem by moving the GoogleService_Info.plist into xcode instead of into my folder. Now it built state B! No old code. Now I just need to figure out how to make sure I copy over everything that's necessary into the new project.

Thanks!

i was having a same problem and according to me my problem was i didn't set class name as MyApp
and as soon as i changed my class name to MyApp....its again working
and because of diffrent name then MyApp a file in test folder named widget_test.dart was having an error......
PS: I am at very early stage of learning flutter this might be not the solution for you😅

Good

Yes it is, I don't have this annoying issue anymore and it's been fixed for quite a while

I'm still facing this issue. I'm on the beta channel running version 1.12.13+hotfix.3. I'm using Android Studio and I have already fixed an error on startup in my app but every time I cold restart my app, I still get the big red error message and the only way to fix it is to hot restart every time.

@Reprevise can you elaborate a bit? cold restart = re-run application?

Yes, like completely stop the app and start it up again.

Can you provide verbose logs from the rerun (example: flutter run -v) and share the error message on startup?

@Reprevise it just looks like you're running a different flutter application in the background and getting logs from it while building (definitely annoying). If you restart your phone and run again can you confirm first if the error is still happening and then if it is still happening if the error goes away if you flutter clean?

I have wiped all of the data from all of my emulators and ran my Flutter application. It showed the error (which it's not supposed to have since it's already been fixed). After I ran flutter clean, the error still showed up on startup.

CORRECTION: It DOES NOT show the error on startup anymore after flutter clean. However, it does show the error in the logs.

I don't think this is related. It seems like your application is up to date but naturally has this bug. If you can file a new issue with a minimal reproduction that would help determine the root cause

v1.12 on the stable channel seems caching the obsolete error console log. Clean/remove doesnt solve the problem. The error keeps displaying until sometimes then vanish for no reason. It confused me a lot.

@gloryluu that has nothing to do with build/clean, I recommend filling a new bug

I have facing some problem in flutter project can any one help me

C:\flutterbin\flutter.bat doctor --verbose
[√] Flutter (Channel master, v1.13.6-pre.38, on Microsoft Windows [Version 10.0.14393], locale en-US)
• Flutter version 1.13.6-pre.38 at C:\flutter
• Framework revision b28dd0c296 (7 days ago), 2019-12-28 10:33:01 +0800
• Engine revision 5a730c60d3
• Dart version 2.8.0 (build 2.8.0-dev.0.0 1db1a837f8)

[!] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
• Android SDK at E:\Android Meterial\AndroidSDK
• Android NDK location not configured (optional; useful for native profiling support)
• Platform android-29, build-tools 29.0.2
• ANDROID_HOME = E:\Android Meterial\AndroidSDK
• Java binary at: C:\Program Files\Android\Android Studio\jrebin\java
• Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b03)
X Android license status unknown.
Try re-installing or updating your Android SDK Manager.
See https://developer.android.com/studio/#downloads or visit https://flutter.dev/setup/#android-setup for detailed instructions.

[√] Android Studio (version 3.5)
• Android Studio at C:\Program Files\Android\Android Studio
• Flutter plugin version 42.1.1
• Dart plugin version 191.8593
• Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b03)

[√] Connected device (1 available)
• SM M105F • 5200ebb94a0346f7 • android-arm • Android 9 (API 28)

! Doctor found issues in 1 category.
Process finished with exit code 0

How to solve these problem in Windows 10 64 bit

"[!] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
• Android SDK at E:\Android Meterial\AndroidSDK
• Android NDK location not configured (optional; useful for native profiling support)
• Platform android-29, build-tools 29.0.2
• ANDROID_HOME = E:\Android Meterial\AndroidSDK
• Java binary at: C:\Program Files\Android\Android Studio\jrebin\java
• Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b03)
X Android license status unknown.
Try re-installing or updating your Android SDK Manager.
See https://developer.android.com/studio/#downloads or visit https://flutter.dev/setup/#android-setup for detailed instructions."

I have the same issue.

[flutter] flutter doctor -v
[√] Flutter (Channel stable, v1.12.13+hotfix.5, on Microsoft Windows [Version 10.0.18363.535], locale en-US)
• Flutter version 1.12.13+hotfix.5 at D:\flutter
• Framework revision 27321ebbad (5 weeks ago), 2019-12-10 18:15:01 -0800
• Engine revision 2994f7e1e6
• Dart version 2.7.0

[√] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
• Android SDK at D:\android-sdk
• Android NDK location not configured (optional; useful for native profiling support)
• Platform android-28, build-tools 28.0.3
• ANDROID_HOME = D:\android-sdk
• Java binary at: C:\Program Files\Android\Android Studio\jrebin\java
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1343-b01)
• All Android licenses accepted.

[!] Android Studio (version 3.4)
• Android Studio at C:\Program Files\Android\Android Studio
X Flutter plugin not installed; this adds Flutter specific functionality.
X Dart plugin not installed; this adds Dart specific functionality.
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1343-b01)

[√] VS Code (version 1.41.1)
• VS Code at C:\Users\Armin\AppData\Local\Programs\Microsoft VS Code
• Flutter extension version 3.7.1

[√] Connected device (1 available)
• Android SDK built for x86 • emulator-5554 • android-x86 • Android 9 (API 28) (emulator)

! Doctor found issues in 1 category.

@jonahwilliams we should probably inventory which parts of the tool still need to be converted to use the new build system, file separate issues for those parts, and close this issue.

Reproducible steps:

  1. Create new Flutter project
  2. To get an error that causes that infamous error screen, call MediaQuery.of(context) in MyApp's build method.
  3. You get the error screen.
  4. Stop debugging (in VSCode & Android Studio, click the red square)
  5. Fix the error (in this case remove the line calling MediaQuery.of(context).
  6. Restart debugging
  7. You get the error screen even though the error was fixed.
  8. Restart the app (in VSCode, press the green refresh icon and in Android Studio, press the "play" button with the little green circle) and notice the error screen is gone.

I'm on Flutter 1.13.6 (latest beta channel version).

UPDATE: Still applies to the latest beta version (1.14.6).

v1.12 on the stable channel seems caching the obsolete error console log. Clean/remove doesnt solve the problem. The error keeps displaying until sometimes then vanish for no reason. It confused me a lot.

Getting the same issue as well.
Flutter (Channel stable, v1.12.13+hotfix.7, on Mac OS X 10.15.2 19C57, locale en-AU)

@shinta5150 The console log issue is a separate regression.

@Reprevise this sounds like a change that isn't hot reloadable, not a build error

@jonahwilliams I never said I hot reloaded. I stopped debugging and restarted it and still got the screen after the error was fixed.

@Reprevise in your project directory there will be a generated file that should contain all of your project's dependencies, something like build/app/intermediates/flutter/debug/flutter_build.d. Could you verify that it contains the name of the file you are changing?

@Reprevise in your project directory there will be a generated file that should contain all of your project's dependencies, something like build/app/intermediates/flutter/debug/flutter_build.d. Could you verify that it contains the name of the file you are changing?

It does contain the name of the file that I am editing.

Great, next thing to check is the file checksum. Its helpful to start this next part after a flutter clean. First - run your build twice with the error intact.

Then open .dart_tool/flutter_build/<some-hash-value>/.filecache and pull the sha for the file you were editing. It will be something like:

{
  "version": 2,
  "files": [
    {"path": "path/you/care/about.dart", "hash": "somevalue"},
    ...
  ],
}

Next, make the change to fix the error and rebuild the app again. Inspect the hash and verify that it either updated or didn't update

Actually, an easier way might to just run in verbose after changing the file. You would be looking for a line like:

skipping kernel_snapshot or now

So, to verify:

I ran the build twice and the error screen came up twice as expected.
I grabbed the sha value.
I fixed the error.
After a rebuild, I found that the sha didn't change.

@jonahwilliams

NOTE: I couldn't reproduce the issue on Linux.

@Reprevise when you run through those steps with verbose, do you see that gradle is skiping the flutter task itself? Like:

[        ] > Task :app:transformClassesAndDexWithShrinkResForRelease UP-TO-DATE
[        ] > Task :app:packageRelease UP-TO-DATE
[        ] > Task :app:assembleRelease
[        ] BUILD SUCCESSFUL in 994ms
[        ] 30 actionable tasks: 4 executed, 26 up-to-date

This will help me narrow down whether or not it is a flutter tool bug or a flutter gradle bug

If this is windows my guess is that there is a formatting error in the depfile which is causing Gradle to incorrectly skip the flutter task. That would square with the sha not updating.

Here's my log from flutter run --verbose:

https://pastebin.com/V5U7G3tj

Note that my file does not contain MediaQuery.of(context) in my build method as the error log suggests. And yes, I'm running Windows.

Okay, we're gradually narrowing down the problem. In FLUTTER_ROOT/packages/flutter_tools/gradle/flutter.gradle you could add a print statement to verify the depfile is parsed correctly:

    @InputFiles
    FileCollection getSourceFiles() {
        FileCollection sources = project.files()
        for (File depfile in getDependenciesFiles()) {
          sources += readDependencies(depfile)
        }
        sources.collect {
            println it
        }
        return sources + project.files('pubspec.yaml')
    }

In the FlutterTask. Then, rerun and grab the contents of the parsed depfile

With the print statement, here's my new flutter run --verbose log:

https://pastebin.com/dVXCUueS

Thanks! looks like the right files are in there - Are the following files your application code:

C:\Users\Owner\Documents\Flutter Apps\error_test\android\app\Apps\error_test\pubspec.yaml
[        ] C:\Users\Owner\Documents\Flutter
[        ] C:\Users\Owner\Documents\Flutter Apps\error_test\android\app\Apps\error_test\.packages
[        ] C:\Users\Owner\Documents\Flutter Apps\error_test\android\app\Apps\error_test\lib\main.dart

I'm going to 🤦‍♂, but I wonder if this is another "space in file path throws off tool on windows" issue. Does the issue repro for you in a Directory without a space? (Not that I'm suggesting this as a long term solution ... )

The android\app\Apps part doesn't exist:

Here's the actual paths to said files:

C:\Users\Owner\Documents\Flutter Apps\error_test\pubspec.yaml
C:\Users\Owner\Documents\Flutter Apps\error_test\.packages
C:\Users\Owner\Documents\Flutter Apps\error_test\lib\main.dart

Also unsure as to why C:\Users\Owner\Documents\Flutter is in there?
But I don't really think the path thing is an issue, just pointing it out.

Also, the "space in file path" might have actually caused the issue.
I've tried very hard to reproduce the issue in a path without a space but I can't.

Thanks for all of the help debugging @Reprevise . With this information I should be able to get a patch put together fairly quickly.

Also unsure as to why C:\Users\Owner\Documents\Flutter is in there?

Looks odd too, not sure yet either but I'll take a look

Possibly related to the empty space in the directory name to be honest.

@Reprevise so I repo'd this on my Windows machine and have a fix pending. If you'd like you can patch it in to your own flutter checkout to verify. Note: you will need to flutter clean first to blow away the bad depfile.

https://github.com/flutter/flutter/pull/50538

The escaping issue is now fixed on master

I'll test master when I get home and report back if it fixes the issue

Seems like it works, rebuilds with the correct code every time so far 🤞 .

Facing same issue since the past few days. Hot Reload has stopped working, have to restart every single time.

@gegobyte this has nothing to do with hot reload

In my case, this situation occured after updating flutter and editing external library. I solved this issue by doing

flutter clean

and then by running

flutter pub cache repair

and then re-build your app.

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.

I haven't had this issue in awhile, I'm on the latest beta 1.15.17.

I suspect that we'll find more focused issues to be more useful/actionable. @jonahwilliams wdyt?

I don't see the issue anymore. I am on channel beta.

The issue seems gone away in stable channel (1.12.13 hotfix 8)

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

In my case, this situation occured after updating flutter and editing external library. I solved this issue by doing

flutter clean

and then by running

flutter pub cache repair

and then re-build your app.

This fix the problem for me!! (Update Dart and Flutter too).

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?

@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!

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!

Ghi chú sau đã được @tvolkert thêm vào ngày 16 tháng 10 năm 2018

Nếu bạn bị ảnh hưởng bởi lỗi này,

Hãy điền vào mẫu dưới đây!

https://goo.gl/forms/eFPT6A3jAD8clU4o2 (Khảo sát để thu thập thông tin về lỗi này)

Các bước để sinh sản

Khi tôi (hoặc một trong những đồng đội của tôi) chạy rung flutter run(hoặc bằng nút chạy / gỡ lỗi trên IntelliJ và VSCode) trên AVD hoặc trên các thiết bị thực, phiên bản đã cài đặt luôn ở phía sau phiên bản mới nhất và tôi luôn cần khởi động lại ứng dụng hoặc thậm chí đôi khi flutter clean.
Đây là một vấn đề đặc biệt là khi quá trình xây dựng trên AVD / thiết bị thực gặp sự cố và giải pháp duy nhất ở đây là flutter clean, ngay cả khi tôi dừng ứng dụng chạy và làm flutter runlại.

Điều tương tự cũng xảy ra khi xây dựng và cài đặt APK sản xuất:
Khi tôi chạy flutter buildflutter install, APK đã cài đặt không được cập nhật.
Nếu tôi chạy rung sạch, và tiếp theo, một lần nữa, flutter buildflutter installAPK đã cài đặt sẽ được cập nhật.

Bác sĩ rung rinh:

[√] 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!

Thanks a lot, I fixed it.

same issue on the last version on stable channel

@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!

I actually fixed it by reïnstalling my complete development environment after executing the commands described earlier. Thank you very much though. :-)

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!

Was this page helpful?
0 / 5 - 0 ratings