Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Checking if android emulator is using KVM accelation or not?

As per the documentation on Check if a hypervisor is installed, I ran the command

./Android/Sdk/emulator/emulator --aceel-check

and it outputs

emulator: ERROR: No AVD specified. Use '@foo' or '-avd foo' to launch a virtual device named 'foo'

instead of

accel: 0 KVM (version 12) is installed and usable.

I already have installed and verified the KVM installation by following ubuntu KVM installation.

$ virsh list --all
Id   Name   State
--------------------

I also do have a working android emulator (Nexus 6).

So is there any way that I can know that my emulator is using KVM or not?

like image 412
RAJESH SAHU Avatar asked Oct 28 '25 12:10

RAJESH SAHU


1 Answers

There is a more certain way to check if an Android emulator is using KVM:

sudo bash -c 'for x in /sys/kernel/debug/kvm/*/vcpu0/pid;
do grep -a Android/Sdk/emulator /proc/`< $x`/cmdline; done'

This looks for a vCPU actually running inside the emulator and whether it's the Android Sdk. When it's working, I get /home/username/Android/Sdk/emulator/qemu/linux-x86_64/qemu-system-x86_64-netdelaynone-netspeedfull-avdPixel_fold_API34.

The thing with -accel-check is that, while official, it only tells you whether the emulator can or is set to use KVM. The problem is that its installed and usable doesn't change even when I don't have any emulators running! Meanwhile lsof might report a false positive during the instant the emulator is trying to use KVM, and doesn't indicate it succeeded. Whereas, when a vCPU is checked for and found, an emulator must certainly be running.

like image 52
Daniel T Avatar answered Oct 30 '25 02:10

Daniel T