macOS Java Android dev setup (Android Studio, Intellij Community Edition, etc.) - mhulse/mhulse.github.io GitHub Wiki

Notice!

I have noticed that the brew cask installation does not install the most recent versions of the apps; I have since uninstalled the cask versions and just downloaded the dmg installers from their respective download pages.

Java bits

Use Homebrew to install Android dev tools

$ brew cask install android-sdk
$ brew cask install android-ndk

Update your environment variables (add this to your .bash_profile):

export ANDROID_NDK_HOME=/usr/local/share/android-ndk
export ANDROID_SDK_ROOT=/usr/local/share/android-sdk

Reload your profile:

$ source "$HOME/.bash_profile"

Accept licenses:

$ yes | sdkmanager --licenses

Install all of the Android SDK components:

$ sdkmanager --update
Warning: File /Users/mhulse/.android/repositories.cfg could not be loaded.
[=======================================] 100% Computing updates...

Note: I think you can ignore the warning.

Occasionally run:

$ brew doctor
$ brew update
# Update all installed packages to the latest version:
$ sdkmanager --update

Lastly, install Eclipse, IntelliJ, Android Studio, or your other favorite IDE.

If you are feeling adventurous, install Android Studio using Homebrew as a cask:

$ brew cask install android-studio
# IntelliJ Community Edition (free):
$ brew cask install intellij-idea-ce
# IntelliJ Pro (paid):
# $ brew cask install intellij-idea

For brew casks, occasionally run:

brew cask outdated | xargs brew cask reinstall

Optimal brew commands to update everything (including casks):

$ brew doctor && brew update && brew upgrade && brew cask outdated | xargs brew cask reinstall && sdkmanager --update && brew cleanup && brew prune && brew doctor

Links