Android SDK

Install

To install the Android SDK, use the following commands in a Terminal:

brew install android-sdk

Once the installation is finished, use the following commands to install the bare minimum components of the Android SDK. IMPORTANT: Make sure to use Java 1.8 at this point, as the “sdkmanager” only works with this version of Java!

#agree to all the licenses
sdkmanager --licenses

#install the actual sdk components
sdkmanager "build-tools;31.0.0"
sdkmanager "platforms;android-31"
sdkmanager "sources;android-31"
sdkmanager "platform-tools"
sdkmanager "cmdline-tools;latest"

If you need to install other SDK components, you may use this command to get a full list of all available components:

sdkmanager --list

Now open/create your hidden “.zshrc” file in your home folder and add the following lines. This will enable you to use the SDKs tools directly in a Terminal:

export ANDROID_SDK_ROOT="/usr/local/share/android-sdk"
export ANDROID_HOME=$ANDROID_SDK_ROOT
export PATH=$ANDROID_HOME/tools:$PATH
export PATH=$ANDROID_HOME/platform-tools:$PATH
export PATH=$ANDROID_HOME/build-tools/$(ls $ANDROID_HOME/build-tools | sort | tail -1):$PATH

At last you need to logout and login with your local account.