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.
- Install the emulator
$ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager --install emulator
- 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"
- Accept the licenses
yes | $ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager --licenses
- 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"
- (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