Mac-Android-Flutter--环境变量配置
2020-03-01 本文已影响0人
zbzbwxe
一.命令行$:
vim ~/.bash_profile
open -e .bash_profile
二.添加路径
#source ~/.profile
export ANDROID_NDK=/Library/Android/android-ndk-r16b
export ANDROID_SDK=/Library/Android/android-sdk-macosx
export ANDROID_HOME=/Library/Android/android-sdk-macosx
export PATH=$PATH:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools:$ANDROID_NDK:$ANDROID_SDK/tools:$ANDROID_SDK/platform-tools
# Add environment variable NDK_ROOT for cocos2d-x
export NDK_ROOT=/Library/Android/android-ndk-r16b
export PATH=$NDK_ROOT:$PATH
# Add environment variable ANDROID_SDK_ROOT for cocos2d-x
export ANDROID_SDK_ROOT=/Library/Android/android-sdk-macosx
export PATH=$ANDROID_SDK_ROOT:$PATH
export PATH=$ANDROID_SDK_ROOT/tools:$ANDROID_SDK_ROOT/platform-tools:$PATH
export FLUTTER_HOME=/Users/TaoZhang/Develop/WorkSpace/flutter
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
三.刷新(命令行$)
source .bash_profile
四.检查
$: flutter doctor
然后Android Studio中配置插件
在Android Studio中创建Flutter
.png
选择 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并按照说明解决问题.