I am using Visual Studio Code on macOS for developing Flutter apps.
I can select a single device in the bottom-left of VSC. I can also run on multiple devices using flutter run -d all
. I am wondering how I can run on multiple devices using the debug console in VSC. Or, at the very least, debug one device but show updates on all.
Thank you
Using: Android Studio 3.2.1 Flutter 1.0.0 Dart 2.1.0 Show activity on this post. and go to "Run" -> "Edit Configurations". Press "+" in upper left corner -> select "Bash". Then set: Select "runall" instead of "main.dart" beside run icon. Performing run (also through shortcut) will now run app on all devices.
In Flutter 1.12 support multi device debugging in VS Code https://github.com/flutter/flutter/wiki/Multi-device-debugging-in-VS-Code well you can run only two devices or two virtual machine at the same time one using command flutter run -d <put the id of the device> If you have different flavors, you can configure your launch.json config as follows.
If you restart Visual Studio Code and load your Flutter project. The new device should show up at the bottom right of the footer. Show activity on this post. run this command in your Visual Studio Code terminal flutter emulators then see the result if you have installed any emulator it will show you.
You can see the bottom menu in VScode, click on this button and you will able to see all the available devices. Show activity on this post. To select a device you must first start both, Android Studio and your virtual device.
If you're on recent versions of Flutter and the Dart/Flutter extensions (Dec 2019 onwards) this is now supported using VS Code's compound launch configurations.
Your .vscode/launch.json
should contain an entry for each device, along with its deviceId
(this is the ID you would pass to flutter run -d xxx
):
{
"version": "0.2.0",
"configurations": [
{
"name": "Current Device",
"request": "launch",
"type": "dart"
},
{
"name": "Android",
"request": "launch",
"type": "dart",
"deviceId": "android"
},
{
"name": "iPhone",
"request": "launch",
"type": "dart",
"deviceId": "iphone"
},
],
"compounds": [
{
"name": "All Devices",
"configurations": ["Android", "iPhone"],
}
]
}
For more information, see https://github.com/flutter/flutter/wiki/Multi-device-debugging-in-VS-Code.
How about this one, it worked for me
flutter run -d all
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With