【问题标题】:How can i see my flutter app output in both Android and IOS simulator simultaneously?如何同时在 Android 和 IOS 模拟器中查看我的颤振应用程序输出?
【发布时间】:2020-08-05 03:14:06
【问题描述】:

我正在使用 android studio 开发 Flutter 应用程序,我想知道有什么方法可以在 android 和 ios 模拟器中看到我的应用程序输出,也可以在两个模拟器上执行热重载?

【问题讨论】:

    标签: xcode android-studio flutter simulator


    【解决方案1】:

    要同时调试多个设备,您应该为每个具有 deviceId 字段集的设备设置启动配置(这与您传递给 flutter run -d xxx 的 ID 相同)。通过单击 Debug -> Open Configurations 打开启动配置。在底部添加一个复合配置,将同时启动两个(或多个)配置:

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

    选择 Debug 侧边栏上的复合配置并单击 Debug -> Start Debugging(或 Start without Debugging)将为每个设备同时启动调试会话。

    【讨论】:

    【解决方案2】:

    是的,有一种方法可以做到这一点首先安装android和ios模拟器,然后在两个模拟器都运行时一个一个Flutter run。你可以从这里Hot reload

    如果您正在寻找同时运行两者,那么只需选择所有可用设备并运行您的命令。 flutter run

    【讨论】:

      【解决方案3】:

      最后,我找到了一个命令,可以在 Ios 和 Android 模拟器中运行应用程序。

      在终端您的应用所在的位置

      中写入以下命令
      flutter run -d all
      

      您可以在终端中按 r 关键字进行热重载。

      【讨论】:

        猜你喜欢
        • 2020-01-07
        • 1970-01-01
        • 2020-09-11
        • 2019-05-31
        • 2020-10-29
        • 2021-09-26
        • 2021-07-09
        • 2017-06-06
        • 1970-01-01
        相关资源
        最近更新 更多