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

Support running on all connected devices #956

Open
mit-mit opened this issue Apr 27, 2017 · 37 comments
Open

Support running on all connected devices #956

mit-mit opened this issue Apr 27, 2017 · 37 comments

Comments

@mit-mit
Copy link
Member

mit-mit commented Apr 27, 2017

flutter_tools as of flutter/flutter@0770c3c supports a -d all option to run on all connected devices. It would be great to support something similar in IJ, for example to have an 'All connected' option in the device picker.

@eseidelGoogle
Copy link

My understanding is that the feature as-designed cannot work with Google's Flutter build setup, and so far I'm not aware of non-demo uses of this feature. :) So I suspect this is relatively low priority?

@devoncarew
Copy link
Member

This matches my understanding - the times I have heard it brought up were all in the context of demos. Perhaps an item to test with users, in terms of their expectations and desired workflows.

@mit-mit
Copy link
Member Author

mit-mit commented Apr 28, 2017

I heard two developers request this feature at First Look. Not for demos, but for being able to make chances and see the effect on both platforms at the same time.

But, we can always add this later once we have more feedback.

@mit-mit
Copy link
Member Author

mit-mit commented May 18, 2017

Got another request for this from a customer at I/O. Their use case was the ability to see both Android and iOS layout at the same time.

@devoncarew
Copy link
Member

From @Hixie:

We have received multiple reports from people at Google I/O that if -d all was available from IntelliJ itself, they would start using Flutter immediately.

@mit-mit
Copy link
Member Author

mit-mit commented Jun 7, 2017

@devoncarew how can this be 'high priority' but not in the current milestone?

@devoncarew
Copy link
Member

Ah, the high priority tag was added by Ian. We can drop it if we don't agree. But I think we're already at capacity for the current milestone, and generally I think are working on the right things (#1060).

@mit-mit
Copy link
Member Author

mit-mit commented Jun 7, 2017

Let's target this for M16 then

@devoncarew
Copy link
Member

In order to limit the scope for the initial implementation, one idea would be that when All is selected in the device chooser, we disable the debug button (run is still enabled).

@mit-mit
Copy link
Member Author

mit-mit commented Jun 7, 2017

That would be fine; it matches the use cases we have heard so far.

@mikelnrd
Copy link

Hi I can see this is on the roadmap so maybe my +1 isn't helpful, but just in case...

I'm a data-science developer and am brand new to mobile development. I just installed intelliJ/android studio/etc and got things working in an hour or two. First thing I did was open an iOS and Android emulator to see if I could hot-reload on both at the same time. Googled it and managed to get it working via the cli using flutter run -d all - it'd be great to be able to do so in intelliJ.

@devoncarew devoncarew modified the milestones: M23, M24 Mar 20, 2018
@DanTup
Copy link
Contributor

DanTup commented Apr 2, 2018

I tried to implement this in Dart Code (based on the above comments, I planned to just always run without debugging in this case), however it seems that flutter run --machine doesn't support this even though the command line does.

I've opened flutter/flutter#16145 requesting it. I think it'd be a great feature (but I don't know how much work it is and whether it would mean changes to the flutter run/daemon APIs).

@devoncarew
Copy link
Member

There may be a reasonable solution (at least for IntelliJ) here. IntelliJ already supports running the same app on multiple devices (iOS silumator, Android emulator, ...) at the same time - this is invoking run on each one separately. We'd then need to:

  • add a user pref to have reload (and save on reload) when there are multiple devices running mean reload on all
  • and optionally, we could add a synthetic device in the dropdown for All (2), and when selected, this could launch on all available devices (likely serially, to avoid any build issues)

@devoncarew
Copy link
Member

@DanTup, does the VS Code plugin currently support having multiple app launches running at once?

@DanTup
Copy link
Contributor

DanTup commented Apr 26, 2018

@devoncarew Probably not - VS Code does support running multiple debug configs at once, but I think we have many assumptions in the code (both in the debug adapter and the editor code) about there only being one session.

We probably need to handle this better long-term so a user could (for ex.) run a Flutter app and a Dart CLI app as a web server/API.

That said, it might not be the best way to handle multiple devices if we wanted to do it from the client; it might be better with that knowledge inside the debug adapter (might be easier to track if one device quits, for example, without having to increase the API between editor and debug adapter; which are still somewhat separate and talk via defined messages).

@stefandevo
Copy link

Any update whether this feature is considered having? I know I still can run on all connected devices (my use case if both phone and tablet), but I have to switch to each running tab and hit the reload button. A save + reload all would be great.

@brianegan
Copy link
Contributor

brianegan commented Mar 28, 2019

Hey all -- this plugin is amazing and I know you're all making great improvements!

I really don't mean to pester, but I'd gently ask the team to consider bumping this task up to the top-ish of your priority list. It is the top issue when sorting by "thumbs up" and was marked P1 about 2 years ago. It'd be great to see it land :)

Thanks for listening!

@mit-mit
Copy link
Member Author

mit-mit commented Mar 28, 2019

cc @devoncarew for prioritization

@devoncarew
Copy link
Member

@DaveShuckerow, who's doing work in this area.

@dustin-graham
Copy link

I'd like to add that with the increased focus on making Flutter increasingly a multi-platform, multi-screen solution, the ability to easily run on multiple devices at once from the IDE would be a great productivity boost when building responsive layouts. I can currently do this from the command line, but having to go press r to do hot reload is one step I wish we could skip and have it work like hot reload on a single device. Thanks for the great tools, you guys are awesome!

@mdalpozzo
Copy link

I got two devices running in debug mode through VSCode with hot reloading working. Create a second config in .vscode/launch.json. You can use same properties as default, just make sure names are different. Select your IOS device and run debug with first config selected. Then select second device and run debug with second config selected.

launch.json

{
    "version": "0.2.0",
    "configurations": [
        
        {
            "name": "FlutterIOS",
            "request": "launch",
            "type": "dart",
            "program": "lib/main.dart"
        },
        {
            "name": "FlutterANDROID",
            "request": "launch",
            "type": "dart",
            "program": "lib/main.dart"
        }
    ]
}

@ollyde
Copy link

ollyde commented Jul 14, 2019

flutter run -d all you just press R in the terminal to reload all connected devices.

Unfortunately with iOS 13 this no longer works because 'macos' is now a device so the flutter run -d all command is currentely broken :-/

@brianegan
Copy link
Contributor

brianegan commented Jul 15, 2019

Thanks @OllyDixon -- yah, using the terminal is what I'm doing now, but it requires this 4-step process for me:

  • cmd+S to save the file
  • cmd+3 to open my terminal (my own shortcut)
  • hit r or R
  • cmd+3 to collapse the terminal again

I'd love it if this was a 1-step process:

  • cmd+S

Seems silly, but it adds about 300-500ms to each hot reload and is just a bit annoying after you get used to the "Hot reload on Save" Goodness

@zaun
Copy link

zaun commented Jul 21, 2019

I'm using flutter run -d all now, but I really would rather not have to switch to terminal from the output tab and hit r.... I don't understand why its so hard to add support to use the debugger to launch to all connected devices and on save, hot reload them.

When developing on phone/table iOS/android I have 2-4 devices up at once to make sure things work everyplace.

I mean this isn't a show stopper, Flutter is amazing as it is, but this would make working with VSCode 1000 time easier.

@DanTup
Copy link
Contributor

DanTup commented Jul 21, 2019

I don't understand why its so hard to add support to use the debugger to launch to all connected devices and on save, hot reload them.

It gets tricky because connecting to debuggers on multiple devices opens the door to things like hitting multiple different breakpoints on different devices at the same time (you could click through to different screens on each, for example). If this is all handled inside the Flutter tool (presenting only a single debug session to the IDE) this wouldn't be presented to the user very well (where does it show that you're stopped if two devices are stopped at different locations? what happens when you step?) so it's likely debugging would have to be disabled if it was done that way.

Another option would be to have the IDE drive multiple sessions (eg. as if you launched the app multiple times, once on each device). This is what I tried to implement (in VS Code) a while back, but right now concurrent builds/reloads don't work because they overwrite each others build output. Supporting this requires additional work which turned out to be nontrivial (see flutter/flutter#18566).

I don't think these issues are insurmountable, but it's unfortunately not as simple as just doing what the console version does.

@zaun
Copy link

zaun commented Jul 22, 2019

just dont support debugging with more than one device... just launching and reloading. I turn off the break on exceptions 99% of the time anyway as it can't tell if they are handled or not reliably. (yes I know thats just me, but better to have launching/reload working than nothing)

@ollyde
Copy link

ollyde commented Jul 22, 2019

@DanTup @zaun it's not really handy for debugging it's really handy for testing mutliplayer apps that you can hot reload. Say if you have rooms that are 5-9 players. Imagine doing that manually it would be a nightmare. Example Kahoot.

@zaun
Copy link

zaun commented Jul 22, 2019

@OllyDixon - I agree. I use it for UI development, see how it looks on phone, tablet portrait and tablet landscape. Thats why I say not worry about supporting debugging with multiple devices. Its the hot-reload on save that I'm missing. So if the issue is supporting debugging as @DanTup said, then just don't support it. Just enable launching and hot-reload.

@DanTup
Copy link
Contributor

DanTup commented Jul 22, 2019

Thats why I say not worry about supporting debugging with multiple devices. Its the hot-reload on save that I'm missing.

There are many features that require a connection to the debugger (VM service) - for example the widget inspector. If you're testing multiple layouts on different form factors and you notice an issue, you might wish to use the widget inspector, but without a VM service connection, you'd might need to stop and then re-launch on a single device (since your editor wouldn't have enough information to know which device you want to inspect - they might all be showing different screens). This limitation may be ok to some, but feel really limiting to others.

I don't know enough about the work required for each solution to know whether it's a good trade-off (I mostly only work on the VS Code extensions - and I'm often asked about supporting this there).

@zaun
Copy link

zaun commented Jul 24, 2019

I guess, I just see being able to launch and hot-reload on save as a huge win, even if nothing else works.

@yshahak
Copy link

yshahak commented Jul 25, 2019

For everyone who use flutter run -d all If you don't want to use the command line directly each time, you can do the following workaround:

Download bashsupport plugin
Create new configuration of bash, leave the script field empty, and in the interperter options cell insert:flutter run -d all.
If this didn't work, you can create a bash file to do that. You can see a details in my asnswer here:

@zaun
Copy link

zaun commented Jul 29, 2019

@yshahak That will fix the hot reload issue?

@DazChong
Copy link

@mdalpozzo Thanks! It's a simple and nice workaround. Now doing Flutter is even more fun.

@DaveShuckerow
Copy link
Contributor

Hi all,

There's also support in IntelliJ to reload or restart all running apps:

Screenshot from 2019-03-19 13-54-36

Linux/Windows hotkeys:
ctrl+alt+
ctrl+alt+shift+\

Mac hotkeys (off the top of my head) should be:
cmd+option+
cmd+option+shift+\

@brianegan
Copy link
Contributor

brianegan commented Jul 30, 2019

Thanks for the heads up, @DaveShuckerow -- hadn't seen that.

Dunno if others feel the same way, but I think it'd be great if this was all part of the normal "Hot Reload on Save" feature, or via the normal Cmd+\ or Cmd+shift+\ shortcuts when multiple instances of the app are running on different devices.

That way it would the workflow would be the same as normal hot reload on a single device and it would "just work".

I could also see a variation where if the device dropdown notices there are multiple devices, it would add a "Run on all devices" option that you could select instead of a single device. When the "Run on all devices" option is selected, it would do the -d all for ya instead of having to run each config individually then know this somewhat hidden option is enabled.

@stevemessick
Copy link
Member

FWIW the Android Studio device selector (for running Android, not Flutter) has an option to launch on multiple devices at once: Run on Multiple Devices.

@mdrideout
Copy link

If you are on Android Studio running on multiple devices, the keyboard shortcuts to hot reload multiple devices are under the run menu.
Screen Shot 2020-10-20 at 7 29 29 PM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
No open projects
M22-M24
  
On Deck
Development

No branches or pull requests