Android Studio KVM Setting?
Asked Answered
S

4

18

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?

Scoliosis answered 29/5, 2015 at 17:7 Comment(0)
T
14

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.

Tarrance answered 18/11, 2015 at 22:54 Comment(0)
U
9

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.

Uncrown answered 27/9, 2018 at 8:2 Comment(0)
S
8

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.

Stereopticon answered 29/6, 2015 at 14:17 Comment(2)
Thank You, runs a bit better even the ARM AVD. But the CPU on the Host computer is still running way to Hard.Scoliosis
As @Tarrance mentions, there is no longer such an option since Android Studio 1.5. I don't see it in Studio 2.0 Preview either. Has it been moved somewhere else?Inefficacious
A
5
  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.)

Ambassadress answered 27/11, 2015 at 8:3 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.