一.命令行$:
vim ~/.bash_profile
open -e .bash_profile
二.添加路径
#source ~/.profile
export ANDROID_NDK=/Users/zhangtao/Library/Android/android-ndk-r16b
export ANDROID_SDK=/Users/zhangtao/Library/Android/android-sdk-macosx
export ANDROID_HOME=/Users/zhangtao/Library/Android/sdk
export PATH=$PATH:$ANDROID_HOME/tools
export PATH=$PATH:$ANDROID_HOME/platform-tools
# Add environment variable NDK_ROOT for cocos2d-x
export NDK_ROOT=/Users/zhangtao/Library/Android/android-ndk-r16b
export PATH=$NDK_ROOT:$PATH
# Add environment variable ANDROID_SDK_ROOT for cocos2d-x
export ANDROID_SDK_ROOT=/Users/zhangtao/Library/Android/android-sdk-macosx
export PATH=$ANDROID_SDK_ROOT:$PATH
export PATH=$ANDROID_SDK_ROOT/tools:$ANDROID_SDK_ROOT/platform-tools:$PATH
#Flutter
export FLUTTER_HOME=/Users/zhangtao/Develop/flutter
export PATH=/Users/zhangtao/Develop/flutter/bin:$PATH
export PATH=$FLUTTER_HOME/bin:$PATH
export PUB_HOSTED_URL=https://pub.flutter-io.cn
export FLUTTER_STORAGE_BASE_URL=https://storage.flutter-io.cn
# Setting PATH for Python 3.8
# The original version is saved in .bash_profile.pysave
PATH="/Library/Frameworks/Python.framework/Versions/3.8/bin:${PATH}"
export PATH
export PATH="/usr/local/opt/python@3.8/bin:$PATH"
alias python="/Library/Frameworks/Python.framework/Versions/3.8/bin/python3.8"
alias pip="/Library/Frameworks/Python.framework/Versions/3.8/bin/pip3.8"
三.刷新(命令行$)
source .bash_profile
四.检查
$: flutter doctor
然后Android Studio中配置插件
在Android Studio中创建Flutter
选择 Flutter SDK 的下载路径 ,大功告成
iOS 运行
1.安装 homebrew
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
2.运行命令:
brew update
brew install --HEAD libimobiledevice
brew install ideviceinstaller ios-deploy cocoapods
pod setup
如果这些命令中的任何一个失败并出现错误,请运行brew doctor并按照说明解决问题.