發表日期:2018-05 文章編輯:小燈 瀏覽次數:2719
本文詳細介紹在mac下配置flutter環境的每一個步驟,通過圖文的方式使得讀者快速理解和掌握flutter的環境搭建流程。
推薦去官網下載,速度并不慢,網址:
https://flutter.io/setup-macos/
點擊鏈接:
筆者在寫這篇文章時候的鏈接為:
https://storage.googleapis.com/flutter_infra/releases/beta/macos/flutter_macos_v0.3.2-beta.zip
先把剛才下載的flutter_macos_v0.3.2-beta.zip解壓縮,筆者選擇使用的目錄是根目錄下的app文件夾
配置環境變量,這里筆者使用命令行:
vim ~/.bash_profile
增加一行:
export PATH=/app/flutter/bin:$PATH
保存一下,注意如果這個文件不存在,那么就新建一個。保存完畢之后運行命令:
source ~/.bash_profile
這個時候應該能運行flutter命令了,我們運行命令行:
flutter -h
這個時候應該能展示flutter的命令幫助:
運行命令行:
flutter doctor
按照檢測結果的說明,如果有[!] ? 標志,表示本行檢測不通過,需要做一些設置或者安裝一些軟件。
[!] Android toolchain - develop for Android devices (Android SDK 27.0.3)
! Some Android licenses not accepted.To resolve this, run: flutter doctor --android-licens
需要運行
flutter doctor --android-licens
這里界面會要求輸入Y/N,一路輸入Y就行了。
? ideviceinstaller is not installed; this is used to discover connected iOS devices.
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
運行命令:
brew install --HEAD libimobiledevice brew install ideviceinstaller brew install ios-deploy brew install cocoapods pod setup
這個步驟有點慢...
當然讀者看到的也許和筆者不太一致,請酌情處理。
這里出現了個錯誤,按照說明,運行:
brew link --overwrite cocoapods
然后繼續運行:
pod setup
如果直接運行這個命令,會相當慢,那么我們曲線解決:
cd ~/.cocoapods/repos git clone https://github.com/CocoaPods/Specs.git
如果還是太慢,那么去
鏈接:https://pan.baidu.com/s/1mQ1VvslwwccdoLRi-I0pNg密碼:lax1
下一份,解壓縮到~/.cocoapods/repos/master目錄
[?] Android Studio (version 3.0)
? Flutter plugin not installed; this adds Flutter specific functionality.
? Dart plugin not installed; this adds Dart specific functionality.
打開android studio, 打開plugin
輸入flutter搜索,點擊中間的 Search in repositories
點擊install,順利的話安裝完畢之后重啟android studio
再次運行
flutter doctor
注意這里有個坑,如果按照指引來做,會一直卡在這里。這里要先重裝一下python,運行下面的命令:
brew reinstall python@2 pip install six
再次運行
flutter doctor
至此,我們的環境就搭建完畢了,可以愉快的開發了。如果還有疑問,那么可以加入qq群854192563 我們一起探討。
日期:2018-10 瀏覽次數:7525
日期:2018-12 瀏覽次數:4598
日期:2018-07 瀏覽次數:5115
日期:2018-12 瀏覽次數:4402
日期:2018-09 瀏覽次數:5756
日期:2018-12 瀏覽次數:10181
日期:2018-11 瀏覽次數:5091
日期:2018-07 瀏覽次數:4845
日期:2018-05 瀏覽次數:5098
日期:2018-12 瀏覽次數:4562
日期:2018-10 瀏覽次數:5377
日期:2018-12 瀏覽次數:6438
日期:2018-11 瀏覽次數:4705
日期:2018-08 瀏覽次數:4850
日期:2018-11 瀏覽次數:12938
日期:2018-09 瀏覽次數:5858
日期:2018-12 瀏覽次數:5084
日期:2018-10 瀏覽次數:4423
日期:2018-11 瀏覽次數:4769
日期:2018-12 瀏覽次數:6299
日期:2018-06 瀏覽次數:4249
日期:2018-08 瀏覽次數:5697
日期:2018-10 瀏覽次數:4681
日期:2018-12 瀏覽次數:4792
日期:2018-07 瀏覽次數:4614
日期:2018-12 瀏覽次數:4783
日期:2018-06 瀏覽次數:4623
日期:2018-11 瀏覽次數:4603
日期:2018-12 瀏覽次數:4526
日期:2018-12 瀏覽次數:5507
Copyright ? 2013-2018 Tadeng NetWork Technology Co., LTD. All Rights Reserved.