Skip to content

Instantly share code, notes, and snippets.

@BitLox
Forked from patrickhammond/android_instructions.md
Last active April 28, 2020 03:39
Show Gist options
  • Save BitLox/40d3a4ab339a5f16d9393b5822b718e0 to your computer and use it in GitHub Desktop.
Save BitLox/40d3a4ab339a5f16d9393b5822b718e0 to your computer and use it in GitHub Desktop.
Easily setup an Android development environment on a Mac

Forked from https://gist.github.com/patrickhammond/4ddbe49a67e5eb1b9c03

Updated 2020-04-28

Here is a high level overview for what you need to do to get most of an Android environment setup and maintained.

Prerequisites (for Homebrew at a minimum, lots of other tools need these too):

  • XCode is installed (via the App Store)
  • XCode command line tools are installed (xcode-select --install will prompt up a dialog)
  • Java

Install Homebrew (https://brew.sh):

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"

Make sure the doctor is happy (do what it tells you):

brew doctor

Use Homebrew to install Android dev tools:

brew install ant
brew install maven
brew install gradle
brew cask install homebrew/cask-versions/adoptopenjdk8
brew cask install android-sdk
brew cask install android-ndk

Install the Android SDK components that you need (you may be prompted to agree to license info and then this will take a while to run). For example, here I am installing version 28:

sdkmanager --verbose --install "build-tools;28.0.3" "platforms;android-28"

To list the versions and packages available:

sdkmanager --list

To show sdkmanager commands available:

sdkmanager --help

Install HAXM for blazing fast emulators. Check out the "Configuring VM Acceleration on Mac" section here: https://developer.android.com/studio/run/emulator-acceleration#vm-mac

Update your environment variables:

export ANT_HOME=/usr/local/opt/ant
export MAVEN_HOME=/usr/local/opt/maven
export GRADLE_HOME=/usr/local/opt/gradle
export ANDROID_HOME=/usr/local/share/android-sdk
export ANDROID_NDK_HOME=/usr/local/share/android-ndk

Update your paths, be aware of the version (bonus points to a better solution to the hardcoded build tools version):

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/28.0.3:$PATH

Periodically run these commands again to ensure you're staying up to date:

brew update
sdkmanager --update --verbose

Install Eclipse, IntelliJ, Android Studio, or your other favorite IDE.

If everything goes smoothly on a moderate network connection you can expect this process to take 2-4 hours.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment