Installing Android Studio on Ubuntu 14.04 LTS, Trusty Tahr 64 bit

2015/01/25

Categories: Software Mobile Tags: trusty tahr ubuntu 64 bit android studio jvm linux android

Installing Android Studio on Ubuntu 14.04 64 bit can be quite tricky. Here’s a list of issues I encountered while trying to get it up and running.

First get Android Studio from the official location here, and install it using the guidelines for your specific OS.

I’ve encountered the following issues on Ubuntu 14.04 64 bit:

Issue 1:

 tools.jar is not in Android Studio classpath. Please ensure JAVA_HOME points to JDK rather than JRE  

Easy fix for this, just install the JDK

 sudo apt-get install openjdk-7-jdk  

add a JAVA_HOME environment variable pointing to the JDK location

 sudo nano /etc/environment 

and add the following line:

 JAVA_HOME=/usr/lib/jvm/java-1.7.0-openjdk-amd64

Save the file and reboot or logout for the changes to apply.

After this you should be able to run studio.sh.

Issue 2:

 Unable to create virtual device

or

 Error:Error: Cannot run program "/home/username/Android/Sdk/build-tools/21.1.2/aapt": error=2, No such file or directory

In general, errors pertaining to running the SDK tools like adb, aapt, etc.

You need to install support for 32 bit, the ia32-libs package.

On Ubuntu 14.04 you can go about like this:

 sudo nano /etc/apt/sources.list

 add the following line to the file:

 deb http://old-releases.ubuntu.com/ubuntu/ raring main restricted universe multiverse

 save and update package indexes:

 sudo apt-get update

then install ia32-libs:

 sudo apt-get install ia32-libs

 After this you should be rid of those pesky errors.

Issue 3:

 Emulator frozen with black screen.

Well, this is a tricky one, there are lots of opinions on the matter: some people just restart the emulator and it works fine, others un-check the Use host GPU check box from the emulator properties, others change the amount of RAM for the emulator, others just wait for 10 minutes for the emulator to start, etc.  None of these did the job for me.

The thing that worked for me was to install the latest driver for my graphic card, an NVIDIA NVS 5200M.

The steps were to get the driver from the NVIDIA website , stopping the X server

 sudo service lightdm stop

open a terminal with Ctrl+Alt+F1 and run the installer as root.

After that I was lucky to just follow the steps in the installer, and avoided reading the large README on installing NVIDIA graphic drivers from the NVIDIA website.