【问题标题】:Change default build target from flutter for web to flutter for Android将默认构建目标从 Flutter for web 更改为 flutter for Android
【发布时间】:2019-09-11 09:53:57
【问题描述】:

我正在使用 VS 代码。在为 web 构建 Flutter 的一些实验之后,它开始为 web 构建每个项目是默认的。我需要恢复默认的 Android 版本。

PS D:\code\2019\dart_app1\app1> flutter devices
2 connected devices:
Windows • Windows • windows-x64    • Microsoft Windows [Version 10.0.17134.984]
Chrome  • chrome  • web-javascript • Google Chrome 76.0.3809.132
>PS D:\code\2019\dart_app1\app1> flutter emulators
3 available emulators:
Nexus_5X_API_29  • Nexus 5X API 29  • Google • android
Nexus_9_API_28   • Nexus 9 API 28   • Google • android
flutter_emulator • flutter emulator • Google • android
To run an emulator, run 'flutter emulators --launch <emulator id>'.
To create a new emulator, run 'flutter emulators --create [--name xyz]'.
You can find more information on managing emulators at the links below:
  https://developer.android.com/studio/run/managing-avds
  https://developer.android.com/studio/command-line/avdmanager

launch.json:

{
    // Use IntelliSense to learn about possible attributes.
    // Hover to view descriptions of existing attributes.
    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Flutter",
            "request": "launch",
            "type": "dart"
        }
    ]
}

【问题讨论】:

    标签: flutter


    【解决方案1】:

    launch.json 文件中使用args 参数指定您的设备:

    {
        "version": "0.2.0",
        "configurations": [
            {
                "name": "Flutter",
                "request": "launch",
                "type": "dart",
                "args": ["-d", "<device name from adb devices output>"]
            }
        ]
    }
    

    或从右侧底部面板中的vscode 中选择。默认情况下,启动器选择第一个可用设备,chrome device 可能总是这样。

    【讨论】:

    • 补充,我使用 fvm 那么路径是fvm/fvm_config.json。泰来帮忙!
    猜你喜欢
    • 2019-09-28
    • 2020-01-29
    • 2021-03-15
    • 1970-01-01
    • 2020-01-20
    • 1970-01-01
    • 2020-04-01
    • 1970-01-01
    • 2017-11-20
    相关资源
    最近更新 更多