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
- 下載最新穩定版本Flutter SDK:
https://storage.flutter-io.cn/flutter_infra/releases/stable/macos/flutter_macos_v1.12.13+hotfix.5-stable.zip - 解壓zip文件到自定義文件夾
cd ~/development unzip ~/Downloads/flutter_macos_v1.12.13+hotfix.5-stable.zip
- 設置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