flutter

今天集成了flutter,準備學習一下,因此寫篇文章記錄一下。android

建議先下載android studio安裝,再下載Xcodeios

到github上下載futter sdk,而後指定路徑,注意路徑(後續步驟會使用)git

檢查是否存在.bash_profile文件:github

open ~/.bash_profile複製代碼

新建.bash_profile文件:vim

一、輸入 vim .bash_profile
二、輸入 i 進行編輯模式
三、而後把須要編輯的內容鍵入,編輯完以後直接按esc退出編輯模式(內容以下)
   export PUB_HOSTED_URL=https://pub.flutter-io.cn
   export FLUTTER_STORAGE_BASE_URL=https://storage.flutter-io.cn
   export PATH=/Users/mac/Documents/development/flutter/bin:$PATH
四、輸入:w進行文件的保存,:wq爲保存並退出指令複製代碼

注意/Users/mac/Documents/development/flutter爲我本身安裝的flutter的路徑,要更換爲本身的路徑xcode

運行如下命令查看是否須要安裝其它依賴項來完成安裝
bash

flutter doctor
複製代碼

結果悲催了,爆了以下幾個錯誤:ide


不要緊,一一解決學習

先解決第一個問題,Android licenses not accepted. To resolve this, run: flutter doctor --android-licensesui

運行flutter doctor --android-licenses
而後一直按照提示輸入y便可複製代碼

第二個問題,libimobiledevice and ideviceinstaller are not installed

安裝 homebrew,中途會須要輸入密碼,安裝完成後輸入以下命令:

brew update
brew install --HEAD usbmuxd
brew link usbmuxd
brew install --HEAD libimobiledevice
brew install ideviceinstaller
複製代碼

第三個問題,ios-deploy not installed.

brew install ios-deploy
複製代碼

第四個問題,Brew can be used to install tools for iOS device development. Download brew at https://brew.sh/. 上面安裝過homebrew,跳過便可。

第五個問題,Android Studio (version 3.4) 

 ✗ Flutter plugin not installed; this adds Flutter specific functionality. 

 ✗ Dart plugin not installed; this adds Dart specific functionality.

以下圖配置便可:


而後再次運行flutter doctor命令,以下圖所示:

這裏就要找緣由了,你也能夠按照圖中To update with Brew, run的提示命令運行,我知道是我xcode沒有更新的緣由,更新一下就行了。


耐心等待更新xcode,再輸入以下命令:

brew install --HEAD libimobiledevice
brew install ideviceinstaller複製代碼

而後輸入flutter doctor命令就以下圖所示:


ok,到此結束!

相關文章
相關標籤/搜索