Android Emulator from Command Line Has Weird Resolution

无人久伴 提交于 2020-01-13 12:46:26

问题


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!


回答1:


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.




回答2:


I experienced this problem, and passing the desired resolution to emulator via the -skin "1440x2560" command-line argument is what worked for me.

I personally was trying to start a "Pixel XL" virtual device. I had hoped that the Android SDK could "just know" what resolution that device should run at, but apparently not. So I googled what resolution that device is supposed to have, and passed it in via -skin, and now I'm satisfied (enough).



来源:https://stackoverflow.com/questions/43614908/android-emulator-from-command-line-has-weird-resolution

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!