美文网首页
flutter mac环境搭建

flutter mac环境搭建

作者: 程序男保姆 | 来源:发表于2020-04-17 11:21 被阅读0次

获取Flutter SDK

  1. 去flutter官网下载其最新可用的安装包,转到下载页

    注意,Flutter的渠道版本会不停变动,请以Flutter官网为准。另外,在中国大陆地区,要想正常获取安装包列表或下载安装包,可能需要翻墙,读者也可以去Flutter github项目下去下载安装包,转到下载页

  2. 解压安装包到你想安装的目录,如:

    cd ~/development
    unzip ~/Downloads/flutter_macos_v0.5.1-beta.zip
    
    
  3. 添加flutter相关工具到path中:

    export PATH=`pwd`/flutter/bin:$PATH
    
  4. 运行 flutter doctor
    运行以下命令查看是否需要安装其它依赖项来完成安装:

     flutter doctor
    

该命令检查您的环境并在终端窗口中显示报告。Dart SDK已经在捆绑在Flutter里了,没有必要单独安装Dart。 仔细检查命令行输出以获取可能需要安装的其他软件或进一步需要执行的任务(以粗体显示)

如果你是download的release包,运行flutter doctor会报如下错误:

Error: The Flutter directory is not a clone of the GitHub project.
       The flutter tool requires Git in order to operate properly;
       to set up Flutter, run the following command:
       git clone -b beta https://github.com/flutter/flutter.git

解决方案:

  1. 在flutter目录执行 git init。不推荐
  2. git clone https://github.com/flutter/flutter.git
    或者按官方推荐使用beta分支。
    git clone -b beta https://github.com/flutter/flutter.git

相关文章

网友评论

      本文标题:flutter mac环境搭建

      本文链接:https://www.haomeiwen.com/subject/othgmhtx.html