I'm creating an Android emulator for Espresso testing from a terminal via this command:
./avdmanager create avd -n TestEmulator1 -k "system-images;android-25;google_apis;x86_64" -c 2000M --tag "google_apis" --device "Nexus 5X"
However when I run the emulator, the resolution is really off
When I check it in the AVD Manager from Android Studio, it looks like the settings are correct. Is there something missing from my command that's causing this issue? It causes all of my tests to fail when run. Thanks!
Add the skin resolution you need like this:
./avdmanager create avd -n TestEmulator1 -k "system-images;android-25;google_apis;x86_64" -c 2000M --tag "google_apis" --device "Nexus 5X"
./emulator -avd TestEmulator1 -no-window -skin 768x1280 &
Or try if something like this (-s "768x1280"
) still works with the new avdmanager
:
android create avd --force -n nexus4-emulator -t "Google Inc.:Google APIs:"$EMULATOR_VERSION --abi $ANDROID_ABI -s "768x1280" --device "Nexus 4" -c 128M
Further information about emulators with a decent size here.
-skin
option is deprecated now.
Try using hw.lcd.width
, hw.lcd.height
, and hw.lcd.depth
to set resolution of the screen inside avd/<avd_name>/config.ini
. Works for me.
Supported options are listed here: https://android.googlesource.com/platform/external/qemu/+/refs/heads/master/android/avd/hardware-properties.ini
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With