- Enable USB debugging on your device.
On most devices running Android 3.2 or older, you can find the option under
Settings > Applications > Development.
On Android 4.0 and newer, it's in
Settings > Developer options.
Note: On Android 4.2 and newer, Developer options is hidden by default. To make it available, go to Settings > About phone and tap Build number seven times. Return to the previous screen to find Developer options.
- Set up your system to detect your device.
If you're developing on Windows, you need to install a USB driver for adb. For an installation guide and links to OEM drivers, see the OEM USB Drivers document.
If you're developing on Mac OS X, it just works. Skip this step.
If you're developing on Ubuntu Linux,
you need to add a udev rules file that contains a USB configuration for each type of device you want to use for development. In the rules file, each device manufacturer is identified by a unique vendor ID, as specified by the ATTR{idVendor} property. For a list of vendor IDs, see USB Vendor IDs, below.
To set up device detection on Ubuntu Linux:
Log in as root and create this file:
/etc/udev/rules.d/51-android.rules
Use this format to add each vendor to the file:
SUBSYSTEM=="usb", ATTR{idVendor}=="0bb4", MODE="0666", GROUP="plugdev"
In this example, the vendor ID is for HTC. The MODE assignment specifies read/write permissions, and GROUP defines which Unix group owns the device node.
Vendor Ids:
- Acer: 0502
- ASUS: 0B05
- Dell: 413C
- Foxconn: 0489
- Garmin-Asus: 091E
- Google: 18D1
- Hisense: 109B
- HTC: 0BB4
- Huawei: 12D1
- K-Touch: 24E3
- KT Tech: 2116
- Kyocera: 0482
- Lenevo: 17EF
- LG: 1004
- Motorola: 22B8
- NEC: 0409
- Nook: 2080
- Nvidia: 0955
- OTGV: 2257
- Pantech: 10A9
- Pegatron: 1D4D
- Philips: 0471
- PMC-Sierra: 04DA
- Qualcomm: 05C6
- SK Telesys: 1F53
- Samsung: 04E8
- Sharp: 04DD
- Sony Ericsson: 0FCE
- Toshiba: 0930
- ZTE: 19D2
Note: The rule syntax may vary slightly depending on your environment. Consult the udev documentation for your system as needed. For an overview of rule syntax, see this guide to writing udev rules.
Now execute:
chmod a+r /etc/udev/rules.d/51-android.rules
Best Answer
Installing and using Android Studio on Ubuntu 16.04 is a task that needs a certain strategy and you need to follow certain steps.
Your system must be equipped with a 64-bit CPU capable of supporting Hardware Virtualization and at least 4 GB of RAM but this will not be enough if you're planning to use other programs while Android Studio is running. In that case, 8 GB is a must. You must be using the 64-bit Ubuntu 16.04 of course.
You need to install the Oracle JDK 8 and this can be done by adding the webupd8team java ppa to your system (
sudo add-apt-repository ppa:webupd8team/java
) and installing both oracle-java8-installer and oracle-java8-set-default.Install the complete KVM/qemu on your system by following the instructions given here.
In the beginning, you will find instructions on how to check if your system's processor is ok for use with KVM. Don't forget to log off and back on after the installation, otherwise your user will not be activated as a member of the libvirtd group and you will not be able to use KVM.
Download the latest Android Studio .zip file from the Android Developer's site and make sure you install the 32-bit support files listed over there. NOTE: The file lib32bz2-1.0 does not exist on 16.04, so you have to install libbz2-1.0:i386 instead, using
sudo apt-get install libbz2-1.0:i386
.Extract the contents of the .zip file in a folder of your choice and create a launcher for the studio.sh file you will find in the android-studio/bin folder and if everything else is ok, it should run fine.
You will need to install all the necessary libraries and images using the android SDK and create the AVD's you'll be using of course but I think you must know that already since you are a developer. In order for the emulator to actually use KVM, you must start it using these emulator parameters:
Update: The command above has been deprecated. You can run your emulator with full hardware virtualization support now by simply using -accel on.
This switch is not necessary though, since the default setting for -accel is auto which means that if KVM is installed correctly, it will be used by default.
The value of 1024 is an example. Use the same amount of memory you configured your AVD to use. Further instructions on how to insert the parameters above to android-studio instead of launching the emulator manually, you can find on the android developers site. Personally, I prefer to launch it manually and have it there whenever I need it.