同时在多个连接的设备/仿真器上运行flutter应用程序 [英] Run flutter app on multiple connected devices/emulators simultaneously
问题描述
如何在多个设备上同时运行flutter应用程序,而不必执行以下顺序过程:选择设备->运行,选择其他设备->运行等?
How can I run my flutter app on multiple devices at the same time without having to go through the sequential procedure of: select a device -> run, select other device -> run, etc.?
使用: Android Studio 3.2.1 颤动1.0.0 Dart 2.1.0
Using: Android Studio 3.2.1 Flutter 1.0.0 Dart 2.1.0
推荐答案
在终端中运行命令:
flutter run -d all
或(例如,root中的runall.sh)创建脚本:
or create a script (e.g. runall.sh in root):
#!/usr/bin/env bash
flutter run -d all
并转到运行"->编辑配置".按左上角的"+"->选择重击".然后设置:
and go to "Run" -> "Edit Configurations". Press "+" in upper left corner -> select "Bash". Then set:
- 名称:runall
- 脚本:[runall.sh脚本的路径]
- 解释器路径:/bin/bash
在运行图标旁边选择"runall"而不是"main.dart".现在,执行运行(也通过快捷方式)将在所有设备上运行应用程序.
Select "runall" instead of "main.dart" beside run icon. Performing run (also through shortcut) will now run app on all devices.
缺点:您必须在运行终端中输入"r",然后输入Enter进行热重载.图标和快捷方式不起作用.但是,热重加载会在所有设备上执行.
Drawback: You'll have to enter "r" followed by Enter in run terminal for hot reload. Icon and shortcut does not work. Hot reload is performed on all devices though.
这只是暂时的解决方法.我很确定flutter插件很快就会解决这个问题.
Just a workaround for now. I'm pretty sure the flutter plugin will cover this soon.
这篇关于同时在多个连接的设备/仿真器上运行flutter应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!