Android Studio Configuration on mac

2019-05-31 08:00 CST

2019-12-22 15:33 CST

Install

Install Java8

java 8 is suitable for android-sdk

brew tap caskroom/versions brew cask install java8

开发环境

brew install ant
brew install maven
brew install gradle
brew cask install android-sdk brew cask install android-ndk
brew cask install intel-haxm
brew cask install android-studio

写入

export ANT\_HOME=/usr/local/opt/ant
export MAVEN\_HOME=/usr/local/opt/maven
export GRADLE\_HOME=/Users/<username>/.gradle/wrapper/dists/gradle-4.10.1-all/<random>/gradle-4.10.1
export GRADLE\_USER\_HOME=/Users/<username>/username>/.gradle
export ANDROID\_HOME=/usr/local/share/android-sdk
export ANDROID\_NDK\_HOME=/usr/local/share/android-ndk
export INTEL\_HAXM\_HOME=/usr/local/Caskroom/intel-haxm
export PATH=$ANT\_HOME/bin:$PATH
export PATH=$MAVEN\_HOME/bin:$PATH
export PATH=$GRADLE\_HOME/bin:$PATH
export PATH=$ANDROID\_HOME/tools:$PATH
export PATH=$ANDROID\_HOME/platform-tools:$PATH
export PATH=$ANDROID\_HOME/build-tools/23.0.1:$PATH

在 .gradle/.gradle.properties 中根据 ss 配置写入

systemProp.http.proxyHost=127.0.0.1
systemProp.http.proxyPort=1087
systemProp.https.proxyHost=127.0.0.1
systemProp.https.proxyPort=1087

AS 配置

  • 设置 gradle 为本地
  • 设置 sdk 为 /usr/local/share/android-sdk
  • 设置 ndk
  • 安装 sdk api 和 设备