Mac環境搭建flutter並配置環境變量


Windows環境搭建flutter

https://blog.csdn.net/ytfunnysite/article/details/81070066

克隆項目

git clone https://github.com/flutter/flutter.git
配置變量,使用中國鏡像

進入當前用戶的home目錄 輸入
cd ~

創建.bash_profile 輸入
touch .bash_profile

編輯.bash_profile文件
open -e .bash_profile

 

如果已存在 .bash_profile

編輯文件

vim ~/.bash_profile


配置鏡像
export PUB_HOSTED_URL=https://pub.flutter-io.cn
export FLUTTER_STORAGE_BASE_URL=https://storage.flutter-io.cn


command + s保存文件
更新配置的環境變量(保存)
source .bash_profile

驗證PATH
echo $PATH

.bash_profile文件配置ANDROID_HOME環境變量:

export PUB_HOSTED_URL=https://pub.flutter-io.cn

export FLUTTER_STORAGE_BASE_URL=https://storage.flutter-io.cn 

export PATH=/Users/(apple自己flutter放置的位置)/flutter/bin:$PATH

//查看sdk方法就說了 想親們都知道

export ANDROID_HOME="/Users/(自己androidsdk路徑)/Library/Android/sdk" 

export PATH=${PATH}:${ANDROID_HOME}/tools 

export PATH=${PATH}:${ANDROID_HOME}/platform-tools

//這個如果需要也加上

export PATH=${PATH}:${ANDROID_HOME}/build-tools/29.0.3(這個是自己安裝的sdk中build-tools選項的版本號)



查看當前flutter版本分支
flutter channel

切換flutter穩定版stable分支
flutter channel stable

查看和升級flutter版本
flutter --version
flutter upgrade
————————————————
版權聲明:本文為CSDN博主「楊天福」的原創文章,遵循 CC 4.0 BY-SA 版權協議,轉載請附上原文出處鏈接及本聲明。
原文鏈接:https://blog.csdn.net/ytfunnysite/article/details/99189417


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM