Flutter安装

最近更新时间 2019-12-27 10:46:55

macOS系统中安装Flutter

系统要求

在macOS系统中运行Flutter,系统需要满足如下要求:

  • 操作系统:macOS(64-bit)
  • 磁盘空间:2.8G(不包括IDE和其他工具需要的空间)
  • 命令工具:Flutter需要如下命令行工具
    • bash
    • curl
    • git 2.x
    • mkdir
    • rm
    • unzip
    • which

获取Flutter SDK

  1. 下载最新稳定版本Flutter SDK:
    https://storage.flutter-io.cn/flutter_infra/releases/stable/macos/flutter_macos_v1.12.13+hotfix.5-stable.zip
  2. 解压zip文件到自定义文件夹
    cd ~/development
    unzip ~/Downloads/flutter_macos_v1.12.13+hotfix.5-stable.zip
  3. 设置Flutter环境变量
    export PATH="$PATH:`pwd`/flutter/bin"

完成以上步骤表示已经成功安装Flutter SDK

检测环境是否正常

通过运行命令来检测当前环境是否已经安装所有依赖(增加 -v 参数可以查看更详细内容)

flutter doctor

#[✓] Flutter (Channel stable, v1.12.13+hotfix.5, on Mac OS X 10.15.2 19C57,
#    locale en)
# 
#[!] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
#    ! Some Android licenses not accepted.  To resolve this, run: flutter doctor
#      --android-licenses
#[!] Xcode - develop for iOS and macOS (Xcode 11.3)
#    ✗ CocoaPods installed but not working.
#        You appear to have CocoaPods installed but it is not working.
#        This can happen if the version of Ruby that CocoaPods was installed with
#        is different from the one being used to invoke it.
#        This can usually be fixed by re-installing CocoaPods. For more info, see
#        https://github.com/flutter/flutter/issues/14293.
#      To re-install CocoaPods, run:
#        sudo gem install cocoapods
#[✓] Android Studio (version 3.5)
#[!] Connected device
#    ! No devices available
#
#! Doctor found issues in 3 categories.

按每个步骤后面提示的命令即可完成相关配置和依赖的安装,如上所示执行如下命令即可:

flutter doctor --android-licenses

sudo gem install cocoapods

 

可能喜欢
最近浏览
正在加载浏览记录