Skip to content

flutter run doesn't pick up code changes in dependent packages with gradle #8315

Closed

Description

@abarth

Steps to Reproduce (on Linux)

  1. mkdir mylib
  2. mkdir mylib/lib
  3. echo "name: mylib" > mylib/pubspec.yaml
  4. echo "const int generation = 1;" >> mylib/lib/bar.dart
  5. flutter create foobar
  6. cd foobar
  7. Add the following to the "dependencies" section of your pubspec.yaml:
  mylib:
    path: ../mylib
  1. Add an import "package:mylib/bar.dart"; to lib/main.dart
  2. Change 'Button tapped $_counter time${ _counter == 1 ? '' : 's' }.', to '$generation',
  3. flutter run

Notice that you see the number 1 in the middle of the screen.

  1. Edit ../mylib/lib/bar.dart to change generation from 1 to 2.
  2. flutter run

Notice that you still see the number 1 in the middle of the screen instead of 2, which is what the code currently does.

Discussion

As part of the build, we output ./android/app/build/intermediates/flutter/debug/snapshot_blob.bin.d, which lists the Dart files that were read during the build. If any of those files change, we need to recreate the snapshot to see the code change. It appears the gradle build is ignoring this file and only considering code changes inside the gradle project itself.

/cc @jakobr-google @eseidelGoogle @goderbauer

Activity

  1. added
    toolAffects the "flutter" command-line tool. See also t: labels.
    c: regressionIt was better in the past than it is now
    and removed
    t: gradle"flutter build" and "flutter run" on Android
    on Feb 21, 2017
  2. added a commit that references this issue on Mar 14, 2017
    32db9e7
  3. added a commit that references this issue on Mar 14, 2017
    9c6ffc8
  4. github-actions commented on Sep 5, 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.

  5. locked as resolved and limited conversation to collaborators on Sep 5, 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

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions