Android Studio
Android Studio Install and configure Android Studio for Android development and emulator management
IDEs Quest #8 Intermediate

Android Studio

Install and configure Android Studio for Android development and emulator management

androidideemulatormobileides
Download as:

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

  1. Download Android Studio from the official website
  2. Run Android Studio the first time and go through the installation steps
  3. Check SDK versions are installed

Ensure Required SDKs are Installed

  1. Open Android Studio
  2. Click on the More Actions dropdown in the middle of the app screen
  3. Choose SDK Manager from the dropdown list
  4. 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:

  1. Click the checkbox for Android SDK Command-line Tools (latest)
  2. Click the checkbox for Android SDK Platform Tools

Add Your Required SDK Build Tools

  1. On the bottom right of the screen, click the checkbox for Show Package Details
  2. There will be a list of all available build-tools versions
  3. Select the version(s) you need
  4. Click Apply
  5. Click OK to confirm the components to be installed
  6. Click Finish
  7. 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

Troubleshooting

SDK Not Found After Installation

If avdmanager or other SDK tools aren’t recognized:

  1. Verify ANDROID_HOME is set correctly:

    echo $ANDROID_HOME
  2. Ensure the SDK location exists:

    ls $ANDROID_HOME
  3. 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, adb configuration, and device keys. If you use adb with physical devices and want to keep your trusted device keys, back up ~/.android/adbkey and ~/.android/adbkey.pub before removing.

Remove Gradle Files

rm -rf ~/.gradle

Warning: The ~/.gradle directory 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

🔗
Download Android Studio developer.android.com

Official Android Studio download page with installation instructions

🔗
AVD Manager Documentation developer.android.com

Learn how to create and manage Android Virtual Devices