本文介绍了VSCode扑扑,如何连接多个设备?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在macOS上使用Visual Studio Code开发Flutter应用.

I am using Visual Studio Code on macOS for developing Flutter apps.

我可以在VSC的左下角选择一个设备.我还可以使用flutter run -d all在多个设备上运行.我想知道如何使用VSC中的调试控制台在多个设备上运行.或者,至少,调试一台设备,但在所有设备上显示更新.

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.

谢谢

推荐答案

如果您使用的是Flutter和Dart/Flutter扩展的最新版本(从2019年12月开始),现在可以使用VS Code的复合启动配置来支持.

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.

您的.vscode/launch.json应包含每个设备的条目以及其deviceId(这是您将传递给flutter run -d xxx的ID):

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"],
        }
    ]
}

有关更多信息,请参见 https://github .com/flutter/flutter/wiki/Multi-device-debugging-in-VS-Code .

For more information, see https://github.com/flutter/flutter/wiki/Multi-device-debugging-in-VS-Code.

这篇关于VSCode扑扑,如何连接多个设备?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-02 13:57