vscode在lauch.json中修改启动参数项以及flutterDoctor报错

从Android Studio转移阵地到VScode,发现flutter doctor的时候有红色,那个红X看的我浑身难受,好不容易解决了以后,找配置启动项的位置又找了半天。。。无语死了

长话短说,下面附上flutter doctor问题以及如何在vscode中配置启动参数项。

flutter doctor报错如下:

Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel stable, 2.8.1, on Microsoft Windows [Version 10.0.19042.1348], locale zh-CN)
[!] Android toolchain - develop for Android devices (Android SDK version 32.0.0)
    X cmdline-tools component is missing
      Run `path/to/sdkmanager --install "cmdline-tools;latest"`
      See https://developer.android.com/studio/command-line for more details.
    X Android license status unknown.
      Run `flutter doctor --android-licenses` to accept the SDK licenses.
      See https://flutter.dev/docs/get-started/install/windows#android-setup for more details.
[√] Chrome - develop for the web
[√] Android Studio (version 2020.3)

解决方案:

需要打开一个Android Studio,通过左上角工具栏Files => Settig =>搜索Android SDK,选择SDK Tools,找到Android SDKCommand-line Tools(latest),选中后点击右下角应用(apply),然后等待下载,完成点击Finish,选择OK ,完成。

再次运行flutter doctor全部绿色。

Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel stable, 2.8.1, on Microsoft Windows [Version 10.0.19042.1348], locale zh-CN)
[√] Android toolchain - develop for Android devices (Android SDK version 32.0.0)
[√] Chrome - develop for the web
[√] Android Studio (version 2020.3)

二、启动项配置:

在项目中找到lauch.json文件,没有的话可以点击左侧工具栏的debug,点击create lauch.json自动创建。下文为flutter启动项初始配置:

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

只需在type后追加"args": [ "aaaaa=1111111", "bbbbb=222222","ccccc=33333"],即可成功配置初始参数。修改后如下:

{
    // 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",
            "args": [parames1=canshu1,parames2=canshu2]
        }
    ]
}

完成。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值