Flutter的window配置

第一步  配置环境变量

在用户变量的环境变量进行配置

export PUB_HOSTED_URL=https://pub.flutter-io.cn
export FLUTTER_STORAGE_BASE_URL=https://storage.flutter-io.cn

第二步  下载Flutter的SDK

在 fluterSDK地址下载你想要的版本的SDK,建议就是新手的就是下载最新的稳定版本

第三步 解压配置环境变量

将下载好的ZIP包解压到你要存放fluter的文件夹里面 建议文件夹不要有英文 防止编译和查找的时候出现错误

在用户变量里配置PATH 如果已经有就在后面追加 用 ; 分开  如果没有的话  就创建一个新的PATH变量  配置的值就是 你解压后的flutter 文件里面bin文件夹的地址

比如我在D盘解压  那我对应的路径就是 D:\fluter\flutter\bin

保存完  记得重新电脑 不然运行 fluter doctor 会出现问题

运行  fluter doctor 可以知道配置的是否缺少或者成功

命令里面 对应 X的就是我们还没有配置成功的东西  这里的话 是缺少 安卓编辑器 Android Studio 编辑器配置链接  根据自己的安装路径 安装到自己要安装的地方

到插件市场  下载插件

有时候你运行 flutter doctor 会出现这个 是因为本地的用户环境变量没有配置  配置一个 ANDROID_HOME        

Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel stable, 2.0.4, on Microsoft Windows [鐗堟湰 10.0.19041.508], l
[X] Android toolchain - develop for Android devices
    X Unable to locate Android SDK.
      Install Android Studio from: https://developer.android.com/studio/index.ht
      On first launch it will assist you in installing the Android SDK component
      (or visit https://flutter.dev/docs/get-started/install/windows#android-set
      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
[√] Android Studio (version 4.1.0)
[√] Connected device (1 available)

最后记得重启电脑 不然不会生效的

有时候你运行SDK  有下面这个问题  是因为有的Android是不被接受  执行一下  flutter doctor --android-licenses  命令, 然后一路就是按 y 就可以了

Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel stable, 2.0.4, on Microsoft Windows [鐗堟湰 10.0.19041.508], locale zh-CN)
[!] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
    X Android licenses not accepted.  To resolve this, run: flutter doctor --android-licenses
[√] Chrome - develop for the web
[√] Android Studio (version 4.1.0)
[√] Connected device (1 available)

! Doctor found issues in 1 category.

 

这样就初步搞定配置  可以愉快的敲起你的 Hello world

猜你喜欢

转载自blog.csdn.net/qq_37564189/article/details/115621052
今日推荐