Flutter 下载
-
Flutter 官网
有很多种方式,我是用的git下载的,比较方便,其他食用方式萝卜青菜各有所爱哈
$ git clone -b master https://github.com/flutter/flutter.git
$ ./flutter/bin/flutter --version
$ git clone -b master https://github.com/flutter/flutter.git
Cloning into 'flutter'...
remote: Enumerating objects: 7, done.
remote: Counting objects: 100% (7/7), done.
remote: Compressing objects: 100% (6/6), done.
remote: Total 173520 (delta 0), reused 3 (delta 0), pack-reused 173513
Receiving objects: 100% (173520/173520), 62.81 MiB | 1.48 MiB/s, done.
Resolving deltas: 100% (132713/132713), done.
Checking out files: 100% (3446/3446), done.
bogon:Flutter mac$ ./flutter/bin/flutter --version
Downloading Dart SDK from Flutter engine de350c4cbb4aa3d4b3258fb8646f8723d3991096...
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- 0:03:00 --:--:-- 0
curl: (56) LibreSSL SSL_read: SSL_ERROR_SYSCALL, errno 54
Failed to retrieve the Dart SDK from: https://storage.googleapis.com/flutter_infra/flutter/de350c4cbb4aa3d4b3258fb8646f8723d3991096/dart-sdk-darwin-x64.zip
If you're located in China, please see this page:
https://flutter.dev/community/china
- 镜像
bogon:Flutter mac$ export PUB_HOSTED_URL=https://pub.flutter-io.cn
bogon:Flutter mac$ export FLUTTER_STORAGE_BASE_URL=https://storage.flutter-io.cn
- 继续
$ ./flutter/bin/flutter --version
Downloading Dart SDK from Flutter engine de350c4cbb4aa3d4b3258fb8646f8723d3991096...
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 121M 100 121M 0 0 35.8M 0 0:00:03 0:00:03 --:--:-- 35.8M
Building flutter tool...
Flutter 1.7.4-pre.69 • channel master • https://github.com/flutter/flutter.git
Framework • revision d6425a2179 (65 minutes ago) • 2019-06-11 21:54:55 -0400
Engine • revision de350c4cbb
Tools • Dart 2.3.3 (build 2.3.3-dev.0.0 b37aa3b036)
╔════════════════════════════════════════════════════════════════════════════╗
║ 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. ║
╚════════════════════════════════════════════════════════════════════════════╝
- 添加flutter相关工具到path中:
$ export PATH=`pwd`/flutter/bin:$PATH
** 查看缺失环节
$ flutter doctor
[✓] Flutter (Channel master, v1.7.4-pre.69, on Mac OS X 10.14 18A391, 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.1)
[✗] 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)
[✓] Connected device (1 available)
! Doctor found issues in 3 categories.
** 解决xx
- brew install --HEAD usbmuxd
遇到的问题:
'''Error: Your Xcode (10.1) is too outdated.
Please update to Xcode 10.2.1 (or delete it).
Xcode can be updated from the App Store.'''
升级xcode,对系统有依赖的话,也要升级下系统
- 第一个x
Android Studio下载地址/
往下拉,选中需要的
- 如果出现'[!] Android Studio (version 3.4)
✗ Flutter plugin not installed; this adds Flutter specific functionality.
✗ Dart plugin not installed; this adds Dart specific functionality.'
打开android studio 的偏好设置,搜索 flutter 下载(dart 会一起下的)
找不到的话,记得在这里取消勾选框,记得apply 。亲测有效
- 协议没找到
[!] Android toolchain - develop for Android devices (Android SDK version 29.0.0)
✗ Android license status unknown.
Try re-installing or updating your Android SDK Manager.
See https://developer.android.com/studio/#downloads or visit https://flutter.dev/setup/#android-setup
for detailed instructions.
解决方法:
$ flutter doctor --android-licenses
A newer version of the Android SDK is required. To update, run:
/Users/mac/Library/Android/sdk/tools/bin/sdkmanager --update
- sdk 位置错了
[✗] Android toolchain - develop for Android devices
✗ ANDROID_HOME = /Users/mac/Library/Application\ Support/AndroidStudio3.4/sdk
but Android SDK not found at this location.
解决:
$ flutter config --android-sdk /Users/mac/Library/Android/sdk
- app 位置错了
[!] Android Studio
✗ Flutter plugin not installed; this adds Flutter specific functionality.
✗ Dart plugin not installed; this adds Dart specific functionality.
✗ Android Studio not found at /Users/mac/Library/Android/sdk/Contents
解决:
$ flutter config --android-studio-dir /Applications/Android\ Studio.app