Flutter 开发环境搭建
下载
官网地址(可能下载费劲):获取最新的 Flutter SDK
github上的地址(比上面强点):flutter-github
安装
-
下载
flutter
安装包,通过上面两个渠道下载flutter
的安装包 -
在桌面创建一个
flutter
的安装目录workspace/flutter
mkdir ~/Desktop/workspace/flutter && cd ~/Desktop/workspace/flutter
-
将上面下载的
flutter
安装包解压到您上面创建的文件夹内unzip ~/Downloads/flutter_macos_v1.7.8+hotfix.4-stable.zip
-
设置环境变量,根据您自己的情况将下面内容添加到
$HOME/.bash_profile
或者$HOME/.zshrc
文件,# 国内用户需要设置 export PUB_HOSTED_URL=https://pub.flutter-io.cn # 国内用户需要设置 export FLUTTER_STORAGE_BASE_URL=https://storage.flutter-io.cn # flutter 环境变量 export PATH=~/Desktop/workspace/flutter/bin:$PATH
注意: 上面设置
flutter
环境变量时,要设置为您自己的flutter
解压的位置 -
检查是否需要安装其它依赖项来完成安装
~ flutter doctor ╔════════════════════════════════════════════════════════════════════════════╗ ║ Welcome to Flutter! - https://flutter.dev ║ ║ ║ ║ The Flutter tool anonymously reports feature usage statistics and crash ║ ║ reports to Google in order to help Google contribute improvements to ║ ║ Flutter over time. ║ ║ ║ ║ Read about data we send with crash reports: ║ ║ https://github.com/flutter/flutter/wiki/Flutter-CLI-crash-reporting ║ ║ ║ ║ See Google's privacy policy: ║ ║ https://www.google.com/intl/en/policies/privacy/ ║ ║ ║ ║ Use "flutter config --no-analytics" to disable analytics and crash ║ ║ reporting. ║ ╚════════════════════════════════════════════════════════════════════════════╝ Doctor summary (to see all details, run flutter doctor -v): [✓] Flutter (Channel stable, v1.7.8+hotfix.4, on Mac OS X 10.14.6 18G84, locale zh-Hans-CN) [✗] Android toolchain - develop for Android devices ✗ 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/setup/#android-setup for detailed instructions). If the Android SDK has been installed to a custom location, set ANDROID_HOME to that location. You may also want to add it to your PATH environment variable. [✓] Xcode - develop for iOS and macOS (Xcode 10.3) [✗] iOS tools - develop for iOS devices ✗ libimobiledevice and ideviceinstaller are not installed. To install with Brew, run: brew update brew install --HEAD usbmuxd brew link usbmuxd brew install --HEAD libimobiledevice brew install ideviceinstaller ✗ ios-deploy not installed. To install: brew install ios-deploy [!] Android Studio (not installed) [!] VS Code (version 1.36.1) ✗ Flutter extension not installed; install from https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter [!] Connected device ! No devices available ! Doctor found issues in 5 categories.
按照上面的提示,将必要软件或者服务装好,就完成了 flutter
开发环境的安装🎉。
title: Flutter 开发环境搭建
tag: iOS
author: zhangpeng
date: 2019.08.08
GitHub: https://github.com/fullstack-zhangpeng
网友评论