mac系统升级之后突然项目打包安卓sdk报错
* What went wrong:
A problem occurred configuring root project 'city_pickers'.
> SDK location not found. Define location with sdk.dir in the local.properties file or with an ANDROID_HOME environment variable.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 1s
The plugin city_pickers could not be built due to the issue above.
很明显这并不是citypicker的问题,大致意思是Android sdk的环境变量未设置好,通过以下方式可以设置ANDROID_HOME的环境变量
1.找到~/.bash_profile
文件
2.在文件中设置home路径 export ANDROID_HOME=/Users/chenhao/Library/Android/sdk
以下是我mac中配置的环境变量
export PATH=/Users/chenhao/flutter/bin:$PATH
export PATH=/usr/local/opt/openssl/bin:$PATH
export PATH=/usr/local/opt/libxml2/bin:$PATH
export PATH="$PATH":"$HOME/flutter/.pub-cache/bin"
export DART_HOME=/Users/chenhao/flutter/bin/cache/dart-sdk/bin
export PATH=${DART_HOME}:${PATH}
export PATH="$PATH":"$HOME/.pub-cache/bin"
export PUB_HOSTED_URL=https://pub.flutter-io.cn
export FLUTTER_STORAGE_BASE_URL=https://storage.flutter-io.cn
# Created by mirror-config-china
export IOJS_ORG_MIRROR=https://npm.taobao.org/mirrors/iojs
export NODIST_IOJS_MIRROR=https://npm.taobao.org/mirrors/iojs
export NVM_IOJS_ORG_MIRROR=https://npm.taobao.org/mirrors/iojs
export ANDROID_HOME=/Users/chenhao/Library/Android/sdk
export PATH=${PATH}:${ANDROID_HOME}/tools
export PATH=${PATH}:${ANDROID_HOME}/platform-tools
export NVMW_IOJS_ORG_MIRROR=https://npm.taobao.org/mirrors/iojs
export NODEJS_ORG_MIRROR=https://npm.taobao.org/mirrors/node
export NODIST_NODE_MIRROR=https://npm.taobao.org/mirrors/node
export NVM_NODEJS_ORG_MIRROR=https://npm.taobao.org/mirrors/node
export NVMW_NODEJS_ORG_MIRROR=https://npm.taobao.org/mirrors/node
export NVMW_NPM_MIRROR=https://npm.taobao.org/mirrors/npm
# End of mirror-config-china