当前位置: 首页 > article >正文

win11+vscode+Flutter 开发环境配置

https://blog.csdn.net/Oven_maizi/article/details/126804404

1 vscode插件 安装

安装红框中的两个

2 flutter sdk 安装

dart sdk 包含在flutter sdk 里面,路径:flutter_windows_3.24.1-stable\flutter\bin\cache\dart-sdk

方式1:

通过vscode安装Flutter插件后,ctrl+shift+p 输入flutter,vscode的右下角会提示安装Flutter sdk

方式2:

​​​​​​​版本列表 | Flutter 中文文档 - Flutter 中文开发者网站 - Flutter

方式3:

下载源码到一个目录,添加它的bin目录路径到 环境变量 中

git clone https://github.com/flutter/flutter.git

3 新建一个 flutter 项目

新建Flutter项目后,可以在lib目录通过终端去执行演示程序

4 演示程序执行前 flutter doctor 检查

首次运行 flutter doctor 报的错误,可以看到报错提示,安卓开发、win开发 还缺少依赖,但

web开发是可以的,那么只需要解决 网络资源不可用问题

PS E:\workspace\test_drive\flutter_application_1\lib> flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel stable, 3.24.1, on Microsoft Windows [版本 10.0.22631.4037], locale zh-CN)
[√] Windows Version (Installed version of Windows is version 10 or higher)
[X] Android toolchain - develop for Android devices
    X Unable to locate Android SDK.
      Install Android Studio from: https://developer.android.com/studio/index.html
      On first launch it will assist you in installing the Android SDK components.
      (or visit https://flutter.dev/to/windows-android-setup for detailed instructions).
      If the Android SDK has been installed to a custom location, please use
      `flutter config --android-sdk` to update to that location.

[√] Chrome - develop for the web
[X] Visual Studio - develop Windows apps
    X Visual Studio not installed; this is necessary to develop Windows apps.
      Download at https://visualstudio.microsoft.com/downloads/.
      Please install the "Desktop development with C++" workload, including all of its default components
[!] Android Studio (not installed)
[√] Connected device (3 available)
[!] Network resources
    X A network error occurred while checking "https://maven.google.com/": 信号灯超时时间已到


! Doctor found issues in 4 categories.

临时解决办法:

在中国网络环境下使用 Flutter | Flutter 中文文档 - Flutter 中文开发者网站 - Flutter

根据上述文档,在powerShell执行下述命令

 $env:PUB_HOSTED_URL="https://pub.flutter-io.cn"
 $env:FLUTTER_STORAGE_BASE_URL="https://storage.flutter-io.cn"

再次运行  flutter dockor,网络错误已经解决。

PS E:\workspace\test_drive\flutter_application_1\linux> flutter doctor
Flutter assets will be downloaded from https://storage.flutter-io.cn. Make sure you trust this source!
Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel stable, 3.24.1, on Microsoft Windows [版本 10.0.22631.4037], locale zh-CN)
[√] Windows Version (Installed version of Windows is version 10 or higher)
[X] Android toolchain - develop for Android devices
    X Unable to locate Android SDK.
      Install Android Studio from: https://developer.android.com/studio/index.html
      On first launch it will assist you in installing the Android SDK components.
      (or visit https://flutter.dev/to/windows-android-setup for detailed instructions).
      If the Android SDK has been installed to a custom location, please use
      `flutter config --android-sdk` to update to that location.

[√] Chrome - develop for the web
[X] Visual Studio - develop Windows apps
    X Visual Studio not installed; this is necessary to develop Windows apps.
      Download at https://visualstudio.microsoft.com/downloads/.
      Please install the "Desktop development with C++" workload, including all of its default components
[!] Android Studio (not installed)
[√] Connected device (3 available)
[√] Network resources

! Doctor found issues in 3 categories.

最终解决办法:

后面又发现上述命令只是临时修改当前终端的环境变量,还需在 Windows 中永久设置环境变量

验证环境变量是否生效

新启动一个powershell,执行下述代码,回显不为空才对

echo $env:PUB_HOSTED_URL

4 web开发

下载一个谷歌

5 android开发 额外配置

1 下载 android studio 

https://developer.android.com/studio/install?hl=zh-cn#windows

2 android studio 安装包,引导式安装 一路都是默认,目标是安装好下面组件

3 打开android studio,额外安装命令行工具

4. 新建android 虚拟机

5.演示程序运行在安卓平台前检查

5.使用vscode启动安卓虚拟机


http://www.kler.cn/a/287001.html

相关文章:

  • DS18B20温度传感器详解(STM32)
  • 将 AzureBlob 的日志通过 Azure Event Hubs 发给 Elasticsearch(3.纯python的实惠版)
  • 软件授权产品介绍
  • 阿里云 Serverless 助力盟主直播:高并发下的稳定性和成本优化
  • AI Agent:深度解析与未来展望
  • Windows11电脑总是一闪一闪的,黑一下亮一些怎么解决
  • 使用BDT利率二叉树模型来计算期权的初始价值
  • “AIGC+开发安全”领域标杆厂商|海云安入选《2024网络安全十大创新方向》报告
  • 我在IBM的时光碎片1 - 回忆昊海大厦
  • C4.5算法原理及Python实践
  • Ubuntu搭建FTP服务器
  • Qt QComboBox下拉菜单显示提示信息
  • Mac环境下OpenTest使用总结
  • 给Ubuntu添加硬盘之后,该如何使用
  • 行为型设计模式-迭代器(Iterator)模式-python实现
  • python利用深度学习(Keras)进行癫痫分类
  • 18046 字母分类统计
  • videojs宫格视频选择播放
  • NCMMSC-CNVSRC 2024视觉语音识别竞赛圆满落幕
  • 在工作中,这些问题,你是不是已经忍了很久?
  • 制作 Docker 镜像
  • 基于LangChain手工测试用例转Web自动化测试生成工具
  • 百度 Android 开发面试题(2024版)
  • Https 加密原理
  • CSS系列之Float浮动(二)
  • 【HarmonyOS】模仿个人中心头像图片,调用系统相机拍照,从系统相册选择图片和圆形裁剪显示 (一)