mark_97
mark_97

Reputation: 317

Android Studio KVM Setting?

Put in KVM (Kernel-based Virtual Machine) into my 64 bit Ubuntu 14.04 LTS per: https://help.ubuntu.com/community/KVM/Installation

In the terminal:

kvm-ok INFO: /dev/kvm exists KVM acceleration can be used

OK so the KVM is in.

When I run the Android Emulator there is no change from the way the Emulator ran before I put in the KVM.

I've looked in to the various settings within Android Studio, and I found nothing obvious about KVM.

Does Android Studio have a setting somewhere to enable KVM?

Upvotes: 18

Views: 42949

Answers (4)

AnotherGit
AnotherGit

Reputation: 89

  1. Downgrade to Android Studio 1.4 (delete Android Studio 1.5 installation, download zip from http://tools.android.com/download/studio/builds/1-4-0, follow installation instructions).
  2. Follow Stuart Axon's instructions above.

Gabor as far as I can tell is correct (and addresses the OP's question) - the option to use this acceleration by starting the emulator from within Android Studio 1.5 has been removed.

(Weirdly, I don't seem to be able access the acceleration when starting the emulator from the command line once Android Studio 1.5 has been installed - but maybe I'm wrong.)

Upvotes: 5

xarlymg89
xarlymg89

Reputation: 2617

Alright, so when you see the message (on Android Studio v2 and higher):

KVM is required to run this AVD.

/dev/kvm device: permission denied

Grant current user access to dev/kvm

What you can do (manually, since I haven't found anything in Android Studio) to fix this is:

  1. Add your Linux user into the kvm group: sudo adduser your_linux_user kvm
    1. If the group doesn't exist, download this package sudo apt install qemu-kvm and try to add your user again into the kvm group.
  2. When the user has successfully been added into the KVM group, logout or restart and try opening Android Studio again.

This setting works totally fine in Ubuntu 18.04/18.10, but it should work in other distros as well.

Upvotes: 9

Stuart Axon
Stuart Axon

Reputation: 1874

You can do this:

Click on Run -> Edit Configurations and go to the Emulator tab

You can add it on "additional commandline options":

-qemu -enable-kvm

I'm not sure if there is also a GUI option somewhere though, or how to check if it is working or not.

I'd test the x86 image to see if it works any faster.

Upvotes: 7

Gabor
Gabor

Reputation: 7572

Android Studio 1.5 and 2.0 do not have such option any more.

Update: that is because the team has made KVM mandatory. And see comments from Google employees claiming that their new 2.0 emulator is also KVM-based.

Upvotes: 14

Related Questions