Skip to content

'flutter run' doesn't rebuild the app if it's changed #7014

Closed

Description

@Hixie

Activity

  1. added
    toolAffects the "flutter" command-line tool. See also t: labels.
    c: regressionIt was better in the past than it is now
    on Nov 24, 2016
  2. added this to the 0: Today milestone on Nov 24, 2016
  3. abarth commented on Nov 30, 2016

    @abarth
    Contributor

    Do we know what needs to change here?

  4. johnmccutchan commented on Nov 30, 2016

    @johnmccutchan
    Contributor

    AFAIK this has never worked reliably. My work flow is often rm -rf build && flutter run

  5. johnmccutchan commented on Nov 30, 2016

    @johnmccutchan
    Contributor

    @abarth To answer your question we need dependency tracking and a check before running to see if any of the source files / assets are newer than the APK/IPA.

  6. johnmccutchan commented on Nov 30, 2016

    @johnmccutchan
    Contributor

    One possible solution I've considered is having flutter tools generate a BUILD.gn for the application and then rely on ninja for dependency tracking and building.

  7. chinmaygarde commented on Nov 30, 2016

    @chinmaygarde
    Contributor

    I doubt we can rely on the user having GN or ninja on their systems.

  8. Hixie commented on Nov 30, 2016

    @Hixie
    ContributorAuthor

    This used to work fine. There is code that verifies if the snapshot needs to be rebuilt or if the assets are changed, etc. It just got disconnected at some point recently.

  9. Hixie commented on Nov 30, 2016

    @Hixie
    ContributorAuthor

    cc @devoncarew who might know more

  10. johnmccutchan commented on Nov 30, 2016

    @johnmccutchan
    Contributor

    @chinmaygarde I was thinking that we would download them from cloud storage so that we can rely on them being present.

  11. Hixie commented on Dec 8, 2016

    @Hixie
    ContributorAuthor

    Maybe we always rebuilt unconditionally before?

    In any case, the flutter run; edit; flutter run workflow absolutely must work or people are going to be pulling their hair out. This used to work, and doesn't work now. We should fix that ASAP. :-)

  12. johnmccutchan commented on Dec 8, 2016

    @johnmccutchan
    Contributor

    I don't know how this ever worked. I traced it to _needsRebuild in build_apk.dart. This function is returning false all the time.

    It's not surprising because, _needsRebuild receives the list of assets, apk, and the AndroidManifest and checks if anything has been modified after the APK was built. There are no checks if any Dart sources have been modified. In fact there is even a really old and wrong comment explaining why:

      // Note: This list of dependencies is imperfect, but will do for now. We
      // purposely don't include the .dart files, because we can load those
      // over the network without needing to rebuild (at least on Android).
  13. devoncarew commented on Dec 9, 2016

    @devoncarew
    Contributor

    If I recall correctly, we would check a few files to see if the native portion of the app had to be rebuilt - if we had to build a new APK. We would then always re-snapshot - and send that over to the device separately - but that was fast enough that we still had a quick turn-around time.

    Maybe we always rebuilt unconditionally before?

    So, yeah, I think that was the case at least for the dart files.

  14. Hixie commented on Dec 9, 2016

    @Hixie
    ContributorAuthor

    It should be relatively easy to just crawl all the .dart files and see if any of them are newer than the last snapshot, right?

  15. 13 remaining items

  16. Hixie commented on Apr 30, 2018

    @Hixie
    ContributorAuthor

    @AlBiNoS14 can you file a new bug that includes precise steps for reproducing this? Thanks

  17. mswehli commented on May 5, 2018

    @mswehli

    Same issue, deleting the build folder seems to fix things though. But not sure how long it lasts.
    Edit: Basically just needed a flutter clean

  18. Hixie commented on May 8, 2018

    @Hixie
    ContributorAuthor

    If you run into this please file a new bug with explicit steps that show how to reproduce it.

  19. eturk1 commented on May 9, 2018

    @eturk1

    on Windows, haven't found exactly when it stops rebuilding.

    The symptom that indicates the failure is stopping at a breakpoint and secondary window with the file opens which is read only and does NOT show recent edits.

    i.e. set a breakpoint in main.dart
    execute to breakpoint, a copy of main.dart now open (it's failed, old code) with path \main.dart
    writable code window labeled as lib\main.dart (shows current code)

    seems deleting build\app\intermediates is enough to get a correct rebuild

  20. zoechi commented on Jun 12, 2018

    @zoechi
    Contributor

    @eturk1 please create a new issue with flutter doctor output and all other information you can provide to allow to reproduce.
    Closed issues aren't monitored.

  21. lukepighetti commented on Jun 18, 2018

    @lukepighetti
    Contributor

    VSC debug auto hot reloads on file save no problems. But flutter run does not. Am I missing an argument of some kind?

  22. zoechi commented on Jun 19, 2018

    @zoechi
    Contributor

    @lukepighetti I'd assume auto hot reload is an IDE feature, not a flutter feature.

  23. lukepighetti commented on Jun 19, 2018

    @lukepighetti
    Contributor

    This issue seems to be related to flutter run having the same functionality. Did it, or does it, have the same functionality?

  24. zoechi commented on Jun 20, 2018

    @zoechi
    Contributor

    @lukepighetti I see what you mean. I'd assume that requires a command option because in the IDE Flutter plugin this can be enabled/disabled.

  25. lvillatoro commented on Oct 26, 2018

    @lvillatoro

    Hello. I got the same issue even when i create new flutter projects. Every time a want to see the changes i need to delete the build folder and then re-run the app.

  26. eturk1 commented on Oct 26, 2018

    @eturk1

    I found you can just delete build\app\intermediates.

    Also found it's much worse when debugging. Just changing one line of code could cause failure, noted when debugging read-only window opens and codee is old.

    (I'm on Windows. Is this happening on all platforms?)

  27. lvillatoro commented on Oct 26, 2018

    @lvillatoro

    Im on Windows too, using Android Studio and Visual Code, same problem in both IDEs

  28. github-actions commented on Sep 1, 2021

    @github-actions

    This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.

  29. locked as resolved and limited conversation to collaborators on Sep 1, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

c: regressionIt was better in the past than it is nowtoolAffects the "flutter" command-line tool. See also t: labels.

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions