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

AOSP - Emulator with Google Apis

Engineering Team

Written by Engineering Team


More articles

Deploying an NFT smart contract

Launching NFTs: Your Guide to Smart Contract Deployment

Read article

Encoding/decoding Android Key

Cracking the Code: Android Key Encoding and Decoding Explained

Read article