Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Flutter attach only works when the main file is called 'lib/main.dart' #20544

Closed
DaveShuckerow opened this issue Aug 13, 2018 · 4 comments
Closed
Assignees
Labels
c: crash Stack traces logged to the console tool Affects the "flutter" command-line tool. See also t: labels.

Comments

@DaveShuckerow
Copy link
Contributor

$ cd path/to/flutter/examples/flutter_gallery
$ mv lib/main.dart lib/run.dart
$ flutter run lib/run.dart
<snip out waiting for the app to deploy and start.>
^C
$ flutter attach
<start the gallery app back up>
Your application could not be compiled, because its dependencies could not be established.
Could not read "path/to/flutter/examples/flutter_gallery/lib/main.dart" when determining Dart dependencies.
@DaveShuckerow DaveShuckerow added c: crash Stack traces logged to the console tool Affects the "flutter" command-line tool. See also t: labels. labels Aug 13, 2018
@DaveShuckerow DaveShuckerow self-assigned this Aug 13, 2018
@DaveShuckerow
Copy link
Contributor Author

The root cause is that the ResidentRunner we use to attach and do hot reloads with will try to find a main.dart file when a target isn't announced. Attach doesn't provide a target, so it uses the default behavior always.

@DaveShuckerow
Copy link
Contributor Author

Suggestion from @jacob314:

https://github.com/dart-lang/sdk/blob/master/runtime/vm/service/service.md#isolate
Isolate.rootLib should give you a good idea what the root library was. Can we use it to handle this case better?

@zoechi zoechi added this to the Goals milestone Jan 30, 2019
@jonahwilliams
Copy link
Member

I think this has since been fixed? https://github.com/flutter/flutter/blob/master/packages/flutter_tools/lib/src/commands/attach.dart#L267

Tentatively closing.

@github-actions
Copy link

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.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 15, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
c: crash Stack traces logged to the console tool Affects the "flutter" command-line tool. See also t: labels.
Projects
None yet
Development

No branches or pull requests

3 participants