Android

How to Install Android Studio in Ubuntu 18.04

Installation of software on ubuntu is not always straightforward and can be quite frustrating.For this reason, this tutorial would take us through a step-by-step approach for installing the software on our ubuntu based machines. While the steps discussed here are specifically for Ubuntu 18.04, it can also be tried on earlier versions of Ubuntu. We would be treating four methods of installation. The first two methods may not work out fine, but the third is sure to help install the software successfully.  However, the first two methods are way easier; therefore I would advise that you try them first.

Android Studio demands a lot of system resources, therefore your machine needs to meet up to a couple of requirements for it to run smoothly.

Here are some important specifications your machine needs to meet:

  • 64-bit distribution capable of running 32-bit applications
  • GNU C Library (glibc) 2.19 or later
  • 3 GB RAM minimum, 8 GB RAM recommended; plus 1 GB for the Android Emulator
  • 2 GB of available disk space minimum,
  • 4 GB Recommended (500 MB for IDE + 1.5 GB for Android SDK and emulator system image)
  • 1280 x 800 minimum screen resolution

Now that we are done checking the necessary details, we can proceed with the installation.

Method 1 (The Ubuntu Software Centre)

The Ubuntu Software Centre remains the easiest place to install ubuntu software from. However, this is only the case when the desired software exists on the software store.

To install Android Studio from the Ubuntu Software Centre, simply search for Android Studio in the search box and you should get a couple of results.

If you are able to find the software,its installation is as easy as clicking the install button. You would get a password prompt to confirm the installation process. After a successful installation process, you should have the Android Studio icon available in your application tray.

If it installed successfully, you can skip the remaining methods and checkup the final setup section.

Method 2 (The Snap Tool)

The Snap tool can come in very handy for installation of software packages, especially when available.

Snaps are containerized software packages that make installation of software easy for users. You do not have to modify any files or type in any scary commands.

However, you need to have Snap installed on your machine in the first place.

To install Snap, use the command below:

sudo apt-get install snapd

After installing Snap successfully, you can proceed to install Android Studio with the command below:

sudo snap install android-studio

This would take some time, therefore you have to wait for some minutes—go get a cup of coffee. It is expected to install successfully, but if for some reason installation fails due to an error like the one below:

error: This revision of snap “android-studio” was published using classic confinement and thus may perform arbitrary system changes outside of the security sandbox that snaps are usually confined to, which may put your system at risk.

You would have to add the –classic parameter to the command as seen below:

sudo snap install android-studio --classic

If it installed successfully, you can skip the remaining methods and checkup the final setup section.

Method 3 (The Zip File)

This is one trusted method of installing Android Studio. However, it may take some time as well as patience typing in the commands.

First: We would have to install the Java Development Kit from Oracle.

Installing the Java Development Kit requires some prerequisites which can be installed with the commands below:

sudo apt update
sudo apt install libc6:i386 libncurses5:i386 libstdc++6:i386 lib32z1 libbz2-1.0:i386 wget

Now we can proceed with installing the JDK with the command below:

sudo add-apt-repository ppa:webupd8team/java
sudo apt update
sudo apt install oracle-java8-installer

This would take a while, however you should stay close by. An Oracle License agreement prompt would come up asking you to confirm an agreement to their terms.

The prompt is usually about four lines long, with an option for you to choose “Yes” or “No”. Choose “Yes” and then proceed.

After a successful installation, you can check Java version with:

java -version

Also you can check the Java compiler’s version with:

javac -version

Next, we change directories to the Downloads directory and download the Android Studio zip file there.  This can be done with the commands below:

cd Downloads/
wget https://dl.google.com/dl/android/studio/ide-zips/3.1.3.0/android-studio
-ide-173.4819257-linux.zip

Just like our previous downloads, this could take some time.  After downloading, unzip the file into the /opt directory where our software files stay with the following command:

sudo unzip android-studio-ide-*-linux.zip -d /opt/

You should now have your android-studio directory unzipped in the /opt directory.

To run android studio, go to the bin directory in the unzipped android studio directory and run the

studio.sh file:
cd /opt/android-studio/bin
studio.sh

It should run fine, however close the launched application—do not proceed with the setup just yet.  You can symlink the studio.sh file to the /bin directory, so you can simply run android studio from any directory on the commandline.

You can do that with the command below:

sudo ln -sf /opt/android-studio/bin/studio.sh /bin/android-studio

However you won’t be able to access Android Studio from your list of applications just yet, we would cover this in the final setup.

Final setup

After finishing installations, launch  Android Studio again—if you used method three, type android-studio in the terminal—and proceed with the Android Studio Setup Wizard.

Running the setup wizard would take some time as the application is expected to make some other downloads.

After completion of all possible downloads, you should download the necessary SDK to develop software for your target android versions. It is expected that this comes up by default, but if it doesn’t you can download it through the following steps:

Click on “File”, then “Settings”, then “Android SDK”. You would see the Android SDKs for the different versions of android you plan to build for, then choose the ones you wish to download.

For those who installed using the third method, you can add the desktop icon to your app tray now. By clicking “Tools” and then “Create Desktop Entry.”

There you have it, Android Studio installed on your Ubuntu 18.04.

About the author

Habeeb Kenny Shopeju

Habeeb Kenny Shopeju

I love building software, very proficient with Python and JavaScript. I'm very comfortable with the linux terminal and interested in machine learning. In my spare time, I write prose, poetry and tech articles.