Installing Android Studio on Ubuntu 64bit is difficult at the moment, at least on Ubuntu 12.04 LTS. I personally spent a lot of (frustrating) time getting it working. To eliminate some of this frustration for others I record the steps I had to take here.
JAVA:
First we need to install Java JDK 7. This is different to how this is done on any other platform. First we need to download the latest version. Go to Oracle’s Java website. Here you should scroll down to the “Java SE 7uXX/XX” part. XX/XX will be two numbers that indicate the sub-version number. As long as it says 7u then things should be ok. Press the DOWNLOAD button that is located under the JDK option
Go down to the box with the title “Java SE Development Kit 7uXX”. Accept the license agreement, and download the Linux x64 tar.gz version. My browser downloads to ~/Downloads, you need to find out where your’s store downloaded files.
Now it is time to install Java:
First we need to uncompress the downloaded file (remember to substitute XX for the actual sub-version you downloaded (e.g. in my example it is 71). Open the terminal (Ctrl + Alt + T) and run
tar xzvf ~/Downloads/jdk-7uXX-linux-x64.tar.gz
Then move the new folder to a suitable place for this sort of program
sudo mv jdk1.7.0_XX/ /usr/local/java/
Now we have to notify Ubuntu that we want to use this Java version using the update-alternatives application. (Remember to substitute the XX with the actual version number)
sudo update-alternatives --install /usr/bin/java java
/usr/local/java/jdk1.7.0_XX/bin/java 1
sudo update-alternatives --install /usr/bin/javac javac
/usr/local/java/jdk1.7.0_XX/bin/javac 1
sudo update-alternatives --install /usr/bin/javaws javaws
/usr/local/java/jdk1.7.0_XX/bin/javaws 1
sudo update-alternatives --config java
sudo update-alternatives --config javaws
Test that it works by running
java -version
java version "1.7.0_XX"
Java(TM) SE Runtime Environment (build 1.7.0_XX-XXX)
Java HotSpot(TM) 64-Bit Server VM (build 24.XX-XXX, mixed mode)
And
javac -version
javac 1.7.0_XX
If you get similar responses then Java has been set up succesfully.
glibc:
On a 32 bit machine it is as simple as running
apt-get install lib32ncurses5 ia32-libs
However on a 64 bit Linux OS Android Studio will be using 32bit libraries, even though you are running 64 bit. So in order to enable this we first need to install those. This is where it gets tricky. Because there are several ways to do this, depending on you version of Ubuntu. Furthermore if you get it wrong the error messages from Ubuntu and Android Studio will be less than useful!
First we need to add the i386 architecture. First try
sudo dpkg --add-architecture i386
If that gives an error message, then test that you OS is a multiarch system. If
ls /etc/dpkg/dpkg.cfg.d/
gives the output
multiarch
then it is and you can run
sudo sh -c "echo 'foreign-architecture i386' > /etc/dpkg/dpkg.cfg.d/multiarch"
and you have now added the i386 architecture.
If it isn’t a multiarch system, I don’t know how to do this, because I haven’t seen it before. Please make a comment about which Ubuntu system you are running and I’ll look at it…
Now we can install the 32bit libraries
sudo apt-get update
sudo apt-get install libc6:i386 libncurses5:i386 libstdc++6:i386
After this we need to install the lib32z21 libraries, which aren’t provided in the i386 architecture files. This library enables working with images within Android Studio. Run
sudo apt-get install lib32z1
and this should be set up.
Android Studio
Go to the Android Studio download site and follow the instructions there. It might (still) not be able to find the Java JDK (it happened on two of our test systems), but just point to /usr/local/java/jdk1.7.0_XX manually in the box they provide.
You should now have a fully functioning Android Studio. If you want to debug on a phone you need to go to the site and follow the instructions there.