1.配置鏡像打開bash_profile
//兩種方式打開
vim ~/.bash_profile
open -n ~/.bash_profile //這種文本方式打開編輯
2.添加全局變量
export PUB_HOSTED_URL=https://pub.flutter-io.cn
export FLUTTER_STORAGE_BASE_URL=[https://storage.flutter-io.cn](https://storage.flutter-io.cn/)
3.下載flutter SDK 文件目錄是/Users/zmx/app/flutter
export PATH=/Users/zmx/app/flutter/bin:$PATH
bash配置完成后
4.遇到問題
(1) flutter項目中iOS調(diào)試真機是不能調(diào)試的趋厉,按照下面步驟一步步進行
image.png
安裝到libimobiledevice 會出現(xiàn)錯誤
brew install --HEAD libimobiledevice
image.png
根據(jù)提示發(fā)現(xiàn) libusbmuxd的版本太低導(dǎo)致的筹误。執(zhí)行下面的命令卸載重裝一下就是最新版本了
brew unlink usbmuxd & brew install --HEAD usbmuxd
(2)遇到iOS模擬器無法啟動
? 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
// 解決方法 https://github.com/flutter/flutter/issues/14293
sudo gem install cocoapods -n /usr/local/bin
(3) 安裝插件卡死問題:
Waiting for another flutter command to release the startup lock...
參考鏈接:https://github.com/flutter/flutter/issues/17422
解決步驟:
查了一下github的flutter issue 找到了解決方法,如下:
1尖阔、打開flutter的安裝目錄/bin/cache/
2、刪除lockfile文件
3宏悦、重啟AndroidStudio
(4)flutter設(shè)置顯示函數(shù)結(jié)尾注釋標簽
AS設(shè)置