Install Android Studio on Mac OS X
The purpose of this section is to guide you to install in your development environment all the dependencies for Android development.
The fastest way is to download and install Android Studio.
Latest current version for Android Studio is available at: https://developer.android.com/studio/index.html
Select the Installer Icon:
To install Android Studio on your Mac, proceed as follows:
- Launch the Android Studio DMG file.
- Drag and drop Android Studio into the Applications folder, then launch Android Studio.
- Select whether you want to import previous Android Studio settings, then click OK.
- The Android Studio Setup Wizard guides you though the rest of the setup, which includes downloading Android SDK components that are required for development.
Click the Next button.
Select a Standard installation and click Next.
On the Verify Settings window, click Finish.
Once installed, you get the Welcome to Android Studio window :
Click on the Configure Button and select SDK Manager:
In the left pane select Android SDK. On the right pane, select the SDK Platforms Tab and select the SDKs for API level 22 up to 24.
Click the OK button to download and install these Android SDKs.
After accepting the licence you should see the following screen:
Wait until all components are installed.
Setup the ANDROID_HOME system variable
Open the SDK Manager and make a copy of the Android SDK Location :
Open the Terminal app and type the following command:
export ANDROID_HOME=/Users/HDO/Library/Android/sdk
To check the ANDROID_HOME is correctly setup type the following commands:
cd $ANDROID_HOME
ls
You should see the following result:
add-ons extras patcher platforms system-images
build-tools licenses platform-tools sources tools
Persist the ANDROID_HOME system variable for the current user
The ANDROID_HOME system variable must be persisted when you leave and resstart a new Terminal Window.
One way to do this is to create or update a .profile file in the user's home directory. This file should contain all the commands that should be executed before the Terminal Window session starts.
Open the Terminal app and type the following commands:
cd $HOME
nano .profile
In the Text Editor, add the following line
export ANDROID_HOME=/Users/HDO/Library/Android/sdk
You should have a screen similar to the following screenshot:
To save the .profile file, type CTRL + X
, then type Y
followed by the ENTER
key.
Once done, quit the Terminal window, reopen a new one and type the following command to check if the system variable has been persisted:
echo $ANDROID_HOME
You should have a non empty response.