For generic skin emulator with default apis (without google apis):
-
List All System Images Available for Download:
sdkmanager --list | grep system-images -
Download Image:
sdkmanager --install "system-images;android-31;default;x86_64" -
Create Emulator:
echo "no" | avdmanager --verbose create avd --force --name "generic_api31_emulator" --package "system-images;android-31;default;x86_64" --tag "default" --abi "x86_64"
For an emulator that mimics a Pixel 5 Device with Google APIs:
-
List All System Images Available for Download:
sdkmanager --list | grep system-images -
Download Image:
sdkmanager --install "system-images;android-33;google_apis;arm64-v8a" -
Create Emulator:
echo "no" | avdmanager --verbose create avd --force --name "pixel_5" --package "system-images;android-33;google_apis;arm64-v8a" --tag "google_apis" --abi "x86_64" --profile pixel_5If you do not use the --device flag, I recommend adding these lines to: ~/.android/avd/generic_10.avd/config.ini or else your emulator will have a very low resolution. Note: Increasing resolution will decrease performance on CI. skin.name=1080x1920 # proper screen size for emulator hw.lcd.density=480 hw.keyboard=yes # enables keys from your laptop to be sent to the emulator If you cannot do this, you can still pass -skin 1080x1920 as an argument when starting the emulator. Keep in mind, you can also pass the --device flag and use a device name from the avdmanager list device command which should also set a default resolution because it will inherit the set of properties of that "device" in the config.ini. -
Run Emulator:
emulator @generic_10 &
- The goal of this gist is to quickly pre-install a range of system images to provide our project teams the ability to run emulators on a range of API levels, from API 19 to API 28.
- These can be run locally or on the base build agent.
- We create two sets of emulators here, one set with pixel hardware emulation and one set with default oem emulation.
See: Google Documentation on Start the emulator from the command line for more info
- Run the sdkmanager --install commands.
- Run the avdmanager commands.
- Add aliases to run the emulators with parameters more easily. Or add these parameters to your build steps in TeamCity.
- Instead of using
emulator @{EMULATOR NAME}to run devices, you can use the aliases if they are added.
- Instead of using
- If you run this locally, you can use the
-read-onlyparameter to run multiple devices at the same time. You can then manually run automation against various APIs for added device coverage during regression.
sdkmanager --install "system-images;android-27;google_apis;x86_64"
sdkmanager --install "system-images;android-28;google_apis;x86_64"
echo "no" | avdmanager --verbose create avd --force --name "pixel_9.0" --device "pixel" --package "system-images;android-28;google_apis;x86_64" --tag "google_apis" --abi "x86_64"
echo "no" | avdmanager --verbose create avd --force --name "generic_9.0" --package "system-images;android-28;google_apis;x86_64" --tag "google_apis" --abi "x86_64"
Note: Add this alias to ~/.bashrc or ~/.zshrc, or just run using these parameters for best results. -skin 768x1280 is useful to run default emulators successfully because they have a very low resolution out-of-the-box.
alias generic_9.0='emulator @generic_9.0 -no-boot-anim -netdelay none -no-snapshot -wipe-data -skin 768x1280 &'
Note: Add this alias to ~/.bashrc or ~/.zshrc, or just run using these parameters for results. Pixel emulators should run at default resolution of 1080x1920 by default, but can specify this just in-case with the parameter: -skin 1080x1920
alias pixel_9.0 ='emulator @pixel_9.0 -no-boot-anim -netdelay none -no-snapshot -wipe-data -skin 1080x1920 &'
Note You can run all of the emulators above with a -read-only parameter to run multiple emulators at the same time, but this is an experimental feature right now.
- aosp_atd and google_atd system images are only available on x86 and ARM architecture at API level 30.
emulator -list-avdswill print list of available devicesavdmanager list,avdmanager list target,avdmanager list devices,avdmanager list avd
- avdmanager list : Lists existing targets or virtual devices.
- avdmanager list avd : Lists existing Android Virtual Devices.
- avdmanager list target : Lists existing targets.
- avdmanager list device : Lists existing devices.



@josevelasdev I too am stuck in the same error, got any solution?