Android studio

From Gentoo Wiki
Jump to: navigation, search
This article is a stub. You can help by expanding it.

This article contains instructions for setting up Android Studio.


These pre-installation steps are required for the Android Studio Emulator program to work. Android Studio will still install and work without these steps but the Emulator will either not launch at all or will appear to be working but will give a cryptic message about "waiting for target to come online". Without these pre-installation steps that wait will be indefinite. The major things to remember are that to have a fully functioning Emulator it is required to have KVM enabled in the kernel(which means that the BIOS must support KVM), qemu installed, and pulseaudio installed.


See QEMU article for information on how to set up KVM and install qemu.

KVM Permissions for Android Studio

QEMU should automatically create a new kvm group on the system and there should now be a /dev/kvm device.

Run this command to view all groups on the system to check if kvm was added:

user $ getent group

Run this command to add the user account name which will be using Android Studio to the kvm group with this command:

root # usermod -a -G kvm gentoofan420

In the above example gentoofan420 is the username.

To check that the user was added to the kvm group you can run the command:

user $ groups gentoofan420

In the above example gentoofan420 is the username.

Next check that /dev/kvm is set to the correct ownership and mode permissions. This can be done with the command:

user $ls -la /dev/kvm

The desired permissions are mode 660(rw-rw----) and the desired ownership should be root:kvm. If it's not already configured that way set the ownership and permission mode with the following commands:

root # chown root:kvm /dev/kvm
root # chmod 660 /dev/kvm

Pulse Audio

See PulseAudio Article for information on how to install pulseaudio.


USE flags

USE flags for dev-util/android-studio A new Android development environment based on IntelliJ IDEA

selinux !!internal use only!! Security Enhanced Linux support, this must be set by the selinux profile or breakage will occur global


root #emerge --ask dev-util/android-studio


  • ~/Android - The Sdk lives here.
  • ~/AndroidStudioProjects - Projects created in Android Studio are found here.


Launch Android Studio with the command:

user $ android-studio


Emulator will not launch

Make sure the proper Sdk tools and the Emulator are installed. This can be checked by going to Tools --> Android --> SDK Manager. Then click on the SDK Tools tab and make sure that the box next to Android Emulator is checked as well as the boxes next to Android SDK Platform-Tools, and Android SDK Tools.

Emulator still will not launch

Make sure an actual Android Virtual Device(AVD) has been created. Create an AVD by clicking on the green play button underneath the Run menu. Then click on Create New Virtual Device and follow the instructions from Android Studio.

Emulator really still will not launch

See the pre-installation section above and make sure the system supports KVM at the bios level, KVM is enabled correctly in the kernel, qemu is installed, and pulseaudio is installed.

And see the permissions section above and make sure /dev/kvm is set to mode 660 and root:kvm.

Emulator really really still will not launch

Android Studio itself may only give cryptic information or may act as though the emulator is launching but never launch it. In the terminal window Android Studio was launched from there may be vague messages about timeout reached.

To find out what's really going on with the emulator launch it directly from the ~/Android/Sdk/tools/emulator. So:

user $ cd ~/Android/Sdk/tools

Then get a list of installed AVDs(Android Virtual Devices) with the command:

user $ ./emulator -list-avds

Then try launching an AVD with the command:

user $ ./emulator -avd Nexus_5X_API_25

Where Nexus_5X_API_25 is an example AVD name.

Pay attention to the terminal and see if it lists any error messages about missing libraries or other information. This approach was helpful in determining the pulseaudio requirement.

Emulator really really really still will not launch

"Have you tried unplugging your Gentoo and then plugging it back in?"

Seriously a system reboot might fix the issue so it's worth a shot at this point. Another thing to try is removing the emulator and the SDK and then reinstalling them. Also double check that all the pre-installation stuff was installed and configured correctly.