flutter doctor過程提示flutter version版本舊

提示5個(gè)錯(cuò)誤
Doctor summary (to see all details, run flutter doctor -v):
[?] Flutter (Channel beta, v0.5.1, on Mac OS X 10.12.2 16C67, locale zh-Hans-CN)
[!] Android toolchain - develop for Android devices (Android SDK 28.0.1)
? Android SDK file not found: /Users/conan/Library/Android/sdk/platforms/android-28/android.jar.
[!] iOS toolchain - develop for iOS devices
? Xcode installation is incomplete; a full installation is necessary for iOS development.
Download at: https://developer.apple.com/xcode/download/
Or install Xcode via the App Store.
Once installed, run:
sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer
? libimobiledevice and ideviceinstaller are not installed. To install, run:
brew install --HEAD libimobiledevice
brew install ideviceinstaller
? ios-deploy not installed. To install:
brew install ios-deploy
? CocoaPods not installed.
CocoaPods is used to retrieve the iOS platform side's plugin code that responds to your plugin usage on the Dart side.
Without resolving iOS dependencies with CocoaPods, plugins will not work on iOS.
For more info, see https://flutter.io/platform-plugins
To install:
brew install cocoapods
pod setup
[?] Android Studio (version 3.1)
? Flutter plugin not installed; this adds Flutter specific functionality.
? Dart plugin not installed; this adds Dart specific functionality.
[!] IntelliJ IDEA Community Edition (version 2016.3.4)
? Flutter plugin not installed; this adds Flutter specific functionality.
? Dart plugin not installed; this adds Dart specific functionality.
? This install is older than the minimum recommended version of 2017.1.0.
[!] IntelliJ IDEA Ultimate Edition (version 2016.3.4)
? Flutter plugin not installed; this adds Flutter specific functionality.
? Dart plugin not installed; this adds Dart specific functionality.
? This install is older than the minimum recommended version of 2017.1.0.
[!] Connected devices
! No devices available
! Doctor found issues in 5 categories.
? flutter git:(beta) flutter doctor
zsh: command not found: flutter
? flutter git:(beta) cd ..
? ~ flutter doctor
zsh: command not found: flutter
解決安裝libimobiledevice and ideviceinstaller
? libimobiledevice and ideviceinstaller are not installed. To install, run:
brew install --HEAD libimobiledevice
brew install ideviceinstaller
提示 /usr/local/Frameworks 路徑?jīng)]有權(quán)限
解決如下 sudo mkdir /usr/local/Frameworks
==> Installing libimobiledevice dependency: python@2
==> Downloading https://homebrew.bintray.com/bottles/python@2-2.7.15_1.high_sier
######################################################################## 100.0%
==> Pouring python@2-2.7.15_1.high_sierra.bottle.1.tar.gz
Error: An unexpected error occurred during the `brew link` step
The formula built, but is not symlinked into /usr/local
Permission denied @ dir_s_mkdir - /usr/local/Frameworks
Error: Permission denied @ dir_s_mkdir - /usr/local/Frameworks
? ~ sudo mkdir /usr/local/Frameworks
Password:
安裝過程日志
~ brew install --HEAD libimobiledevice
==> Installing dependencies for libimobiledevice: libxml2, pkg-config, libtasn1, libplist, libusb, usbmuxd
==> Installing libimobiledevice dependency: libxml2
==> Downloading https://homebrew.bintray.com/bottles/libxml2-2.9.7.high_sierra.b
######################################################################## 100.0%
==> Pouring libxml2-2.9.7.high_sierra.bottle.tar.gz
==> Caveats
This formula is keg-only, which means it was not symlinked into /usr/local,
because macOS already provides this software and installing another version in
parallel can cause all kinds of trouble.
If you need to have this software first in your PATH run:
echo 'export PATH="/usr/local/opt/libxml2/bin:$PATH"' >> ~/.zshrc
For compilers to find this software you may need to set:
LDFLAGS: -L/usr/local/opt/libxml2/lib
CPPFLAGS: -I/usr/local/opt/libxml2/include
==> Summary
?? /usr/local/Cellar/libxml2/2.9.7: 281 files, 10.4MB
==> Installing libimobiledevice dependency: pkg-config
==> Downloading https://homebrew.bintray.com/bottles/pkg-config-0.29.2.high_sier
######################################################################## 100.0%
==> Pouring pkg-config-0.29.2.high_sierra.bottle.tar.gz
?? /usr/local/Cellar/pkg-config/0.29.2: 11 files, 627.2KB
==> Installing libimobiledevice dependency: libtasn1
==> Downloading https://homebrew.bintray.com/bottles/libtasn1-4.13.high_sierra.b
######################################################################## 100.0%
==> Pouring libtasn1-4.13.high_sierra.bottle.tar.gz
?? /usr/local/Cellar/libtasn1/4.13: 59 files, 435KB
==> Installing libimobiledevice dependency: libplist
==> Downloading https://homebrew.bintray.com/bottles/libplist-2.0.0.high_sierra.
######################################################################## 100.0%
==> Pouring libplist-2.0.0.high_sierra.bottle.tar.gz
?? /usr/local/Cellar/libplist/2.0.0: 31 files, 768.6KB
==> Installing libimobiledevice dependency: libusb
==> Downloading https://homebrew.bintray.com/bottles/libusb-1.0.22.high_sierra.b
######################################################################## 100.0%
==> Pouring libusb-1.0.22.high_sierra.bottle.tar.gz
?? /usr/local/Cellar/libusb/1.0.22: 29 files, 514.8KB
==> Installing libimobiledevice dependency: usbmuxd
==> Downloading https://homebrew.bintray.com/bottles/usbmuxd-1.0.10_1.high_sierr
######################################################################## 100.0%
==> Pouring usbmuxd-1.0.10_1.high_sierra.bottle.tar.gz
?? /usr/local/Cellar/usbmuxd/1.0.10_1: 13 files, 120KB
==> Installing libimobiledevice --HEAD
==> Cloning https://git.libimobiledevice.org/libimobiledevice.git
Cloning into '/Users/conan/Library/Caches/Homebrew/libimobiledevice--git'...
remote: Counting objects: 8152, done.
remote: Compressing objects: 100% (5441/5441), done.
remote: Total 8152 (delta 6094), reused 3619 (delta 2654)
Receiving objects: 100% (8152/8152), 1.53 MiB | 92.00 KiB/s, done.
Resolving deltas: 100% (6094/6094), done.
==> Checking out branch master
Already on 'master'
Your branch is up to date with 'origin/master'.
==> ./autogen.sh
==> ./configure --disable-silent-rules --prefix=/usr/local/Cellar/libimobiledevi
==> make install
?? /usr/local/Cellar/libimobiledevice/HEAD-26373b3_2: 67 files, 1013.8KB, built in 1 minute 12 seconds
==> Caveats
==> libxml2
This formula is keg-only, which means it was not symlinked into /usr/local,
because macOS already provides this software and installing another version in
parallel can cause all kinds of trouble.
If you need to have this software first in your PATH run:
echo 'export PATH="/usr/local/opt/libxml2/bin:$PATH"' >> ~/.zshrc
For compilers to find this software you may need to set:
LDFLAGS: -L/usr/local/opt/libxml2/lib
CPPFLAGS: -I/usr/local/opt/libxml2/include
For pkg-config to find this software you may need to set:
PKG_CONFIG_PATH: /usr/local/opt/libxml2/lib/pkgconfig
安裝 ideviceinstaller
~ brew install ideviceinstaller
Updating Homebrew...
==> Auto-updated Homebrew!
Updated 1 tap (homebrew/core).
==> Updated Formulae
php-code-sniffer tomcat@8
==> Installing dependencies for ideviceinstaller: libzip
==> Installing ideviceinstaller dependency: libzip
==> Downloading https://homebrew.bintray.com/bottles/libzip-1.5.1.high_sierra.bo
######################################################################## 100.0%
==> Pouring libzip-1.5.1.high_sierra.bottle.tar.gz
?? /usr/local/Cellar/libzip/1.5.1: 134 files, 577KB
==> Installing ideviceinstaller
==> Downloading https://homebrew.bintray.com/bottles/ideviceinstaller-1.1.0_4.hi
######################################################################## 100.0%
==> Pouring ideviceinstaller-1.1.0_4.high_sierra.bottle.tar.gz
?? /usr/local/Cellar/ideviceinstaller/1.1.0_4: 8 files, 64.5KB
安裝 ios-deploy
~ brew install ios-deploy
Updating Homebrew...
==> Downloading https://homebrew.bintray.com/bottles/ios-deploy-1.9.2.high_sierr
######################################################################## 100.0%
==> Pouring ios-deploy-1.9.2.high_sierra.bottle.tar.gz
?? /usr/local/Cellar/ios-deploy/1.9.2: 7 files, 153.8KB
To install:
brew install cocoapods
pod setup
? ~ brew install ios-deploy
Updating Homebrew...
==> Downloading https://homebrew.bintray.com/bottles/ios-deploy-1.9.2.high_sierr
######################################################################## 100.0%
==> Pouring ios-deploy-1.9.2.high_sierra.bottle.tar.gz
?? /usr/local/Cellar/ios-deploy/1.9.2: 7 files, 153.8KB
? ~ brew install cocoapods
==> Downloading https://homebrew.bintray.com/bottles/cocoapods-1.5.3.high_sierra
######################################################################## 100.0%
==> Pouring cocoapods-1.5.3.high_sierra.bottle.tar.gz
?? /usr/local/Cellar/cocoapods/1.5.3: 8,923 files, 13.2MB
? ~ pod setup
Setting up CocoaPods master repo
$ /usr/bin/git clone https://github.com/CocoaPods/Specs.git master --progress
Cloning into 'master'...
remote: Counting objects: 2314481, done.
remote: Compressing objects: 100% (467/467), done.
remote: Total 2314481 (delta 227), reused 254 (delta 99), pack-reused 2313894
Receiving objects: 100% (2314481/2314481), 557.37 MiB | 2.65 MiB/s, done.
Resolving deltas: 100% (1333677/1333677), done.
Setup completed
解決
[!] iOS toolchain - develop for iOS devices
? Xcode installation is incomplete; a full installation is necessary for iOS development.
Download at: https://developer.apple.com/xcode/download/
Or install Xcode via the App Store.
Once installed, run:
sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer
? ~ sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer
Password:
xcode-select: error: invalid developer directory '/Applications/Xcode.app/Contents/Developer'
//出現(xiàn)如上錯(cuò)誤是因?yàn)槲野惭bXcode之后沒有把應(yīng)用添加到應(yīng)用程序目錄下面:
//這里把Xcode添加進(jìn)去,在執(zhí)行命令就好了。
? ~ sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer
Password:
? ~
iOS 安裝pod
? ios git:(beta) ? pod install
Generated.xcconfig must exist. If you're running pod install manually, make sure flutter build or flutter run is executed once first.
Analyzing dependencies
Downloading dependencies
Generating Pods project
Integrating client project
Pod installation complete! There are 0 dependencies from the Podfile and 0 total pods installed.
[!] The Podfile does not contain any dependencies.
[!] Automatically assigning platform `ios` with version `8.0` on target `Runner` because no platform was specified. Please specify a platform for this target in your Podfile. See `https://guides.cocoapods.org/syntax/podfile.html#platform`.
? ios git:(beta) ?
android 解決錯(cuò)誤
[!] Android toolchain - develop for Android devices (Android SDK 28.0.1)
! Some Android licenses not accepted. To resolve this, run: flutter doctor --android-licenses
再診斷一次 ,現(xiàn)在ANDROID的環(huán)境除了兩個(gè)插件之外都已經(jīng)配置好了。
這里注意下要配置下flutter的路徑,不然不能在任何路徑下使用flutter。
翻墻安裝好Flutter的插件。iOS和ANDROID環(huán)境就已經(jīng)OK了。
? Flutter plugin not installed; this adds Flutter specific functionality.
? Dart plugin not installed; this adds Dart specific functionality.
? ~ flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[?] Flutter (Channel beta, v0.5.1, on Mac OS X 10.13.6 17G65, locale zh-Hans-CN)
[?] Android toolchain - develop for Android devices (Android SDK 28.0.1)
[?] iOS toolchain - develop for iOS devices (Xcode 9.4.1)
[?] Android Studio (version 3.1)
[!] IntelliJ IDEA Ultimate Edition (version 2016.3.4)
? Flutter plugin not installed; this adds Flutter specific functionality.
? Dart plugin not installed; this adds Dart specific functionality.
? This install is older than the minimum recommended version of 2017.1.0.
[!] IntelliJ IDEA Community Edition (version 2016.3.4)
? Flutter plugin not installed; this adds Flutter specific functionality.
? Dart plugin not installed; this adds Dart specific functionality.
? This install is older than the minimum recommended version of 2017.1.0.
[?] Connected devices (1 available)
! Doctor found issues in 2 categories.
修改配置文件
export PUB_HOSTED_URL=https://pub.flutter-io.cn //國內(nèi)用戶需要設(shè)置
export FLUTTER_STORAGE_BASE_URL=https://storage.flutter-io.cn //國內(nèi)用戶需要設(shè)置
export PATH=`FLUTTER_ROOT`/flutter/bin:$PATH //這里是我的路徑配置 沒給全部
主要是最上面兩個(gè)配置不然應(yīng)用可能跑不了。
如果出現(xiàn)flutter command locked ,說明其他地方可能在執(zhí)行flutter命令,得停止掉, 一開始項(xiàng)目運(yùn)行不了,可能需要執(zhí)行flutter upgrade 命令。
到這里我已經(jīng)在mac運(yùn)行起來了項(xiàng)目。但是對Dart語音一點(diǎn)了解都沒有。