安装android-sdk,gradle mac 篇

时间:2022-11-08 08:56:09

安装android-sdk,gradle mac 篇

安装包管理器 Homebrew

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

使用包管理器 Homebrew 安装 android-sdk

brew cask install android-sdk
  • 若是遇到 Warning: File /Users/zjh/.android/repositories.cfg could not be loaded.
touch ~/.android/repositories.cfg

配置PATH

vim ~/.bash_profile
  • 设置Path如下
# Setting PATH for android-sdk
export ANDROID_SDK_ROOT=/usr/local/share/android-sdk
export PATH="${PATH}:${ANDROID_SDK_ROOT}/tools:${ANDROID_SDK_ROOT}/platform-tools"
  • 差不多一切都顺利了,在ionic项目下运行
ionic cordova build android

报错,找不到Gradle,我的天!!

安装 Gradle

brew install gradle
  • 配置
vim .bash_profile
// 写入
export PATH="${PATH}:/usr/local/Cellar/gradle/4.0.1/bin"
  • 检查
gradle -v