How to create an AOSP emulator

The Android emulator created via android studio is heavy and comes with many features that we don't use in our apps especially Google APIs so it is recommended to use the Android Open Source Project (AOSP) emulator and here are step-by-step instructions.

  1. Install the emulator
$ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager --install emulator
  1. Provision the emulator system image based on your CPU architecture

a. Intel CPU

$ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager "system-images;android-34;default;x86_64"

b. M CPU:

$ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager "system-images;android-34;default;arm64-v8a"
  1. Accept the licenses
yes | $ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager --licenses
  1. Create the emulator

a. Intel CPU

$ANDROID_HOME/cmdline-tools/latest/bin/avdmanager create avd --force -n Pixel_API_34 -d pixel --package "system-images;android-34;default;x86_64"

b. M CPU

$ANDROID_HOME/cmdline-tools/latest/bin/avdmanager create avd --force -n Pixel_API_34 -d pixel --package "system-images;android-34;default;arm64-v8a"
  1. (optional) Disable caching so every time you run the emulator it will be a fresh start

a. Navigate to emulator settings

b. Click on "Snapshots"

c. Click on "Settings"

d. Change the "Save quick boot state on exit AVD: < emulator name >" to "No"

e. Click "Save Now"

f. Restart the emulator

Left: AOSP

Right: Emulator with Google Apis

Written by

Guy Shahine

Guy Shahine

Founder / CEO

guyshahine.com

Guy is a software engineer with over 20 years of experience in building video games, web, mobile and cloud applications. He has a passion for creating high-quality software solutions that are scalable, reliable, and user-friendly. Guy is also an advocate for agile methodologies and best practices in software development.

View profile →

Tap a star to rate

More posts

Encoding/decoding Android Key

Encoding/decoding Android Key

Cracking the Code: Android Key Encoding and Decoding Explained

Apr 10, 2023
Bits, Bytes and Qubits—Here Comes the Quantum Computer

Bits, Bytes and Qubits—Here Comes the Quantum Computer

Exploring the Quantum Frontier: Journey into advanced computing

Aug 21, 2023