Android Emulator on Virtual machine is too slow

When I am running my android scripts on emulator(Pixel) in local device, it runs smoothly without any delay. But the same script if I try to run on my Virtual machine, the emulators are too slow. It hardly loads and runs the script. There is a huge difference in speed and performance.

Local System config:
Windows 10, GPU enabled
16 GB RAM

VM config:
16GB RAM, GPU unsupport
Intel® Xeon® Gold 6130 CPU @ 2.10GHz 2.10 GHz (2 processors)

Has anyone faced any such issue? Please let me know how to resolve it.

Virtual machines often have limited resources compared to a physical machine, which can affect performance.
to improve the performance of emulators on your virtual machine
make sure your virtual machine is allocated enough resources such as CPU, RAM and disk space. Consider increasing allocated resources if possible.
Using Lightweight Emulators for example, you can try using the Android Emulator with x86 system images, which tend to perform better than ARM-based emulators.

I have been using x86 system images. Tried with Pixel-2 and Intel HAXM, still the emulators do not work on Virtual machine. Sometimes the scripts do not even start on emulators. Does GPU plays any role on VM machines? Can there be any other way to work with emulators on VM?

You can do this, but I would not expect the emulator to perform well in such case, as nested emulation takes place there (emulator itself is also a virtual machine). Check https://www.quora.com/How-do-I-run-a-Android-emulator-on-a-virtual-machine for more details.

GPU also plays an important role there as the emulator uses OpenGL in order to accelerate drawing. Without hardware acceleration this all work is offloaded to CPU.

You could try to run a dockerized version though, which should perform much better as docker itself creates minimal virtualization overhead. Check https://github.com/appium/appium-docker-android for more details.

2 Likes