可以先看下翻译官方文档https://book.flutterchina.club/chapter1/install_flutter.html
先下载flutter dev放目录,解压
开始设置path环境变量,有几个地方需要注意的地方
iov-lpc:~ $ brew update
-bash: brew: command not found
iov-lpc:~ $ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
安装完成后,update
ov-lpc:~ =$ /usr/local/bin/brew update
安装cocoapods
iov-lpc:~ $ sudo gem install cocoapods
iov-lpc:~ $ touch .bash_profile
-bash: touch: command not found
iov-lpc:~ $ export PATH=/usr/bin:/usr/sbin:/bin:/sbin:/usr/X11R6/bin
iov-lpc:~ $ touch .bash_profile
iov-lpc:~ $ vim .bash_profile
iov-lpc:~ $ open -t ~/.bash_profile
export PUB_HOSTED_URL=https://pub.flutter-io.cn
export FLUTTER_STORAGE_BASE_URL=https://storage.flutter-io.cnxport
PATH=/usr/local/bin:$PATH:/usr/bin:/usr/sbin:/bin:/sbin:/usr/X11R6/bin:/Users/YOU/dev/flutter/bin:$PATH
[[ -s "$HOME/.profile" ]] && source "$HOME/.profile" # Load the default .profile
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function* export
ANDROID_HOME="/Users/YOU/Library/Android/sdk"
export PATH=${PATH}:${ANDROID_HOME}/tools
export PATH=${PATH}:${ANDROID_HOME}/platform-tools
iov-lpc:~ $ source .bash_profile
iov-lpc:~ $ flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, v1.9.1+hotfix.6, on Mac OS X 10.15.1
19B88, locale zh-Hans-CN)
[!] Android toolchain - develop for Android devices (Android SDK
version 29.0.1)
✗ Android licenses not accepted. To resolve this, run: flutter
doctor --android-licenses
解决方案:运行 flutter doctor --android-licenses
[!] Xcode - develop for iOS and macOS (Xcode 11.2.1)
✗ CocoaPods not installed.
CocoaPods is used to retrieve the iOS and macOS platform
side's plugin code that responds to your plugin usage on the
Dart side.
Without CocoaPods, plugins will not work on iOS or macOS.
For more info, see https://flutter.dev/platform-plugins
To install:
解决方案: sudo gem install cocoapods
[!] Android Studio (version 3.5)
✗ Flutter plugin not installed; this adds Flutter specific
functionality.
✗ Dart plugin not installed; this adds Dart specific
functionality.
[!] VS Code (version 1.40.0)
✗ Flutter extension not installed; install from
https://marketplace.visualstudio.com/items?itemName=Dart-Code.fl
utter
解决方案:install flutter
[!] Connected device
! No devices available---没有设备很正常
环境搭建完成正确结果
iov-lpc:~ $ flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, v1.9.1+hotfix.6, on Mac OS X 10.15.1 19B88, locale zh-Hans-CN)
[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.1)
[✓] Xcode - develop for iOS and macOS (Xcode 11.2.1)
[✓] Android Studio (version 3.5)
[✓] VS Code (version 1.40.2)
[!] Connected device
网友评论