This post will cover the steps to create an Android Virtual Device (AVD) only using the android command line tools. It is possible to do Android development without an IDE like Android Studio 😀.

🛠 Install Android Commandline Tools

The easiest way to use the standalone Android SDK is by using the android-commandlinetools via Homebrew. Since the sdk depends on Java, that will be needed as well. Im using temurin but other jdks are available. Note that android-sdk has been depricated and it is reccomended to use android-commandlinetools.

brew update
brew tap homebrew/cask-versions
brew install --cask temurin19
brew install --cask android-commandlinetools

After installing temurin follow the instructions in the prompt for adding this version of java to your path. Add environment variables for the SDK. Add this to your startup shell script. Most likely ~/.zshrc.

export ANDROID_HOME="/opt/homebrew/share/android-commandlinetools"

📦 Android SDK Components

  1. build-tools - Component of the Android SDK required for building Android apps.
  2. platform-tools - Tools useful for debugging, such as adb, fastboot, and systrace.
  3. emulator - Launches the AVDs.
  4. system-images - Used for creating an AVD.
  5. platforms - The Android platform to target. This is the version you will build your app against.

We can install all these components together using one command.

Replace the system-image with whichever type works for your machine. I’m using an M1 MacBook so arm64-v8a;2 is what I chose.

sdkmanager "build-tools;35.0.0" "platform-tools" "emulator" "system-images;android-35;google_apis;arm64-v8a" "platforms;android-35"

# verify everything got installed
sdkmanager --list_installed

📱 Create the AVD

Next we’ll use avdmanager to create the android virtual device.

avdmanager create avd -n "Pixel_7" -d "pixel_7" -k "system-images;android-35;google_apis;arm64-v8a"

🔥 Start an Emulator with the new AVD

emulator -list-avds
emulator -avd Pixel_7