Installing Android Studio IDE on Ubuntu Linux

Earlier I created a post on installing the Android Studio IDE on Windows 10. Although I imagine that will be a more popular post, I have created a Linux version of this tutorial because that is what I will be doing my development on. Personally I have just grown to like Linux more, but to each their own.

Enough rambling.. Let’s install Android Studio IDE.

Start by beginning your download of Android Studio IDE.

Android-Studio-IDE-Download

Read and accept the terms and conditions. Click “DOWNLOAD ANDROID STUDIO 2.1 FOR LINUX” to begin the download.

Download the Java SE Development Kit required by the Android Studio IDE.

Java-SE-Development-Kit-Download

According to the instructions provided by the Android developer website, there are additional packages required for 64 bit installs. Run the following commands to install the required 32-bit packages (Ubuntu):

sudo dpkg –add-architecture i386

sudo apt-get update

sudo apt-get install lib32z1 lib32ncurses5 libbz2-1.0:i386 lib32stdc++6

Create a directory for your Java application:

sudo mkdir -p /usr/local/java

Copy the downloaded Java SE Development Kit binary package to your newly created directory:

sudo cp /home/yourUserName/Downloads/jdk-8u101-linux-x64.tar.gz /usr/local/java

Change your current directory to your new java one:

cd /usr/local/java

Unpack the binaries from the jdk package:

sudo tar xzf jdk-8u101-linux-x64.tar.gz

Add the Java SE Development Kit folder you a new environment variable by editing you profile file:

sudo nano /etc/profile

Add the following two lines to the bottom of the file:

JAVA_HOME=/usr/local/java/jdk1.8.0_101
export JAVA_HOME

Save and exit (Ctrl+x, y, Enter)

Set your default Java to the newly unpacked Oracle Java

sudo update-alternatives –install “/usr/bin/java” “java” “/usr/local/java/jdk1.8.0_101/bin/java”

sudo update-alternatives –install “/usr/bin/javac” “javac” “/usr/local/java/jdk1.8.0_101/bin/javac”

sudo update-alternatives –install “/usr/bin/javaws” “javaws” “/usr/local/java/jdk1.8.0_101/bin/javaws”

sudo update-alternatives –set java /usr/local/java/jdk1.8.0_101/bin/java

sudo update-alternatives –set javac /usr/local/java/jdk1.8.0_101/bin/javac

sudo update-alternatives –set javaws /usr/local/java/jdk1.8.0_101/bin/javaws

Reload profile so environment variable is now able to be used:

. /etc/profile

Finally, the Java SE Development Kit is installed. Confirm by typing the following:

java -version

 

Now, what we’ve all been waiting for, the Android Studio IDE installation. The instructions are given to you once you have downloaded the installer package but if you’re having trouble you can try following these steps in a terminal window:

Unzip the Android Studio IDE installer package:

unzip /home/yourUserName/Downloads/android-studio-ide-143.3101438-linux.zip -d /home/yourUserName/Downloads/

Move the unpacked files to your usr local directory:

sudo mv /home/yourUserName/Downloads/android-studio /usr/local/

Navigate to the android-studio/bin directory and run the studio.sh script:

cd /usr/local/android-studio/bin

./studio.sh

Choose whether you would like to import settings from a custom location and click OK.

Follow the rest of the onscreen instructions and you’re done!

The following line will create a symbolic link in your local bin directory so you can launch Android Studio IDE from anywhere in the terminal.

sudo ln -s /usr/local/android-studio/bin/studio.sh /usr/bin/android-studio

Now whenever you want to startup Android Studio from the command line, just type:

android-studio

If you have any troubles with this guide or have noticed any mistakes please let me know!

Links

Java SE Development Kit 8 Downloads

Android Studio IDE Download

Unable to locate package lib32bz2-1.0

How to Install Oracle Java JDK on Ubuntu Linux

 

Leave a Reply

Your email address will not be published. Required fields are marked *