Android Studio
Install and configure Android Studio for Android development and emulator management
What is Android Studio?
Android Studio is the official integrated development environment for Google’s Android operating system, built on IntelliJ IDEA software and designed specifically for Android development.
Android Studio is used for creating and managing Android emulators and for running tests on Android devices.
Prerequisites
Installation
- Download Android Studio from the official website
- Run Android Studio the first time and go through the installation steps
- Check SDK versions are installed
Ensure Required SDKs are Installed
- Open Android Studio
- Click on the More Actions dropdown in the middle of the app screen
- Choose SDK Manager from the dropdown list
- Under SDK Platforms:
- Click the checkbox of the SDK version you want
- Ensure that Show Package Details is checked to see the QEMU packages
Ensure Command Line Tools are Installed
This is important for Appium and other command-line tools.
Under SDK Tools:
- Click the checkbox for Android SDK Command-line Tools (latest)
- Click the checkbox for Android SDK Platform Tools
Add Your Required SDK Build Tools
- On the bottom right of the screen, click the checkbox for Show Package Details
- There will be a list of all available build-tools versions
- Select the version(s) you need
- Click Apply
- Click OK to confirm the components to be installed
- Click Finish
- Click OK to close the settings dialog
Configure Environment Variables
Close Android Studio and add the following to your ~/.zshrc or ~/.bashrc config
file:
# Android Studio
export ANDROID_SDK_ROOT=$HOME/Library/Android/sdk
export ANDROID_HOME=$ANDROID_SDK_ROOT # legacy alias
export PATH=$PATH:$ANDROID_SDK_ROOT/emulator
export PATH=$PATH:$ANDROID_SDK_ROOT/platform-tools
export PATH=$PATH:$ANDROID_SDK_ROOT/cmdline-tools/latest/bin
Verify Installation
Open a new terminal session:
avdmanager list target
Good to Know
- UI Automator is no longer supported - use #inspector instead
- For emulator configuration, see the Android Emulator android tools guide
Troubleshooting
SDK Not Found After Installation
If avdmanager or other SDK tools aren’t recognized:
-
Verify ANDROID_HOME is set correctly:
echo $ANDROID_HOME -
Ensure the SDK location exists:
ls $ANDROID_HOME -
Re-source your shell config:
source ~/.zshrc # or ~/.bashrc for bash
HAXM/Hypervisor Issues on Apple Silicon
Apple Silicon Macs don’t need HAXM. If you see HAXM-related errors:
- Ensure you’re using ARM-based system images (not x86)
- Install the appropriate emulator: SDK Tools > Android Emulator
”Command Line Tools Not Found” Error
# Verify the installation path
ls $ANDROID_HOME/cmdline-tools/latest/bin
# If missing, reinstall via SDK Manager
# SDK Tools > Android SDK Command-line Tools (latest)
Gradle Sync Failed
- Update Android Studio to the latest version
- Check your internet connection
- Clear the Gradle cache:
rm -rf ~/.gradle/caches
Uninstalling
Simply dragging Android Studio to the Trash leaves behind gigabytes of SDK files, emulator images, caches, and preferences scattered across your system.
Remove the Application
rm -rf /Applications/Android\ Studio.app
Remove User Data and Preferences
# IDE preferences
rm -rf ~/Library/Preferences/AndroidStudio*
rm -rf ~/Library/Preferences/com.google.android.*
rm -rf ~/Library/Preferences/com.android.*
# Application support
rm -rf ~/Library/Application\ Support/AndroidStudio*
rm -rf ~/Library/Application\ Support/Google/AndroidStudio*
# Logs
rm -rf ~/Library/Logs/AndroidStudio*
# Caches
rm -rf ~/Library/Caches/AndroidStudio*
# Legacy configuration (older versions)
rm -rf ~/.AndroidStudio*
Remove the Android SDK
First confirm your SDK location:
echo $ANDROID_SDK_ROOT
echo $ANDROID_HOME
If either prints a path other than ~/Library/Android/sdk, remove that path
instead. Then remove the SDK:
rm -rf ~/Library/Android/sdk
Remove Android Emulator Data
rm -rf ~/.android
This directory contains your emulator images,
adbconfiguration, and device keys. If you useadbwith physical devices and want to keep your trusted device keys, back up~/.android/adbkeyand~/.android/adbkey.pubbefore removing.
Remove Gradle Files
rm -rf ~/.gradle
Warning: The
~/.gradledirectory is shared by all Gradle-based projects (not just Android). If you use Gradle for other projects (e.g., Spring Boot, Kotlin), do not remove this directory or back it up first.
Remove Project Files
Warning: This permanently deletes your Android project source code. Back up any projects you want to keep before running this command.
rm -rf ~/AndroidStudioProjects
Clean Up Environment Variables
Remove Android-related entries from ~/.zshrc or ~/.bashrc (whichever you
used during installation):
# remove these lines if present
export ANDROID_SDK_ROOT=...
export ANDROID_HOME=...
export PATH=$PATH:$ANDROID_SDK_ROOT/emulator
export PATH=$PATH:$ANDROID_SDK_ROOT/platform-tools
export PATH=$PATH:$ANDROID_SDK_ROOT/cmdline-tools/latest/bin
Then reload your shell config or restart your terminal:
source ~/.zshrc # or source ~/.bashrc
Verify Removal
# should return "command not found"
which adb
which emulator
which sdkmanager
Resources
Official Android Studio download page with installation instructions
Learn how to create and manage Android Virtual Devices