Install the android-sdk on Ubuntu 14.04

By Rémi GATTAZ Linux Polytech RICM4

Step 1 : Check you java installation

Before anything, since the android sdk doesn't work with every versions of java, you need to check if the one you have is compatible. If you have java installed, this command will print the information you are looking for.

$ java -version

What you need is a JDK (Java Development Kit) with a version number greater or equal to 1.6. A JRE (Java Runtime Environment), whichever version it may be in, will not do.

If your java installation is not meeting these requirements, install the latest version of the JDK. As of today, it is the 1.8 version.

$ sudo add-apt-repository ppa:openjdk-r/ppa
$ sudo apt-get update
$ sudo apt-get install openjdk-8-jdk
$ sudo update-java-alternatives -s java-1.8.0-openjdk

Check again your version of java, it should now be the version 1.8.

Step 2: Download the SDK

The latest version of the sdk is available here.

Step 3 : Install the sdk

After downloading it, you will need to extract the content of the archive and place it somewhere you will not delete it. I suggest your home directory.

$ cd ~/Téléchargements
$ tar xzf android-sdk_<version>-linux.tgz
$ mv android-sdk-linux/ ~/.android-sdk

Now, we will create an environment variable called ANDROID_HOME. Why ? Because some programs need this variable to locate the android sdk on your computer and this will make their job easier.

$ echo '### android-sdk ###' >> ~/.bashrc
$ echo "export ANDROID_HOME=~/.android-sdk" >> ~/.bashrc

The tools are now installed and you can start the android sdk manager using the following command :

$ ~/.android-sdk/tools/android

But, I think you will agree, it's not very convenient to start a program using a full path. So we will modify the PATH variable to start the programm with just the program name android

$ echo '### android tools ###' >> ~/.bashrc
$ echo 'PATH=$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools:$PATH' >> ~/.bashrc

Now, you can now start the android sdk-manger using a simple command.

$ android

Using this program, you will be able to install different android platforms and even more importantly, the sdk tools and sdk platform tools.

Comments powered by Disqus