Installing Java 8 and Android Studio on Ubuntu 18.04

Throughout this tutorial, we'll see how to install Java 8 and Android Studio on either Ubuntu 18.04.

Android Studio by Google is the official IDE for building Android mobile applications so before you can do any Android mobile development you need to have a development machine ready with Java 8 and Android installed.

Android Studio has the best and fastest tools for building apps for each type of Android devices.

Android Studio

Android Studio has many features such as:

Installing Java 8 on Ubuntu 18.04

Java 8 is required for developing Android applications and as such you need to install Java first. You have many choices for Java:

  • The official Oracle Java
  • The open source version of Java -- OpenJDK

Let's install the Oracle Java using a PPA by running the following commands:

First start by adding the PPA:

sudo add-apt-repository ppa:webupd8team/java

Next, you'll need to update the cache using:

sudo apt-get update

Finally, install java-common and oracle-java8-installer packages using the following command:

sudo apt-get install java-common oracle-java8-installer

When installing these packages you will be prompted to accept the Oracle License agreement. You need to accept it for the installation to complete.

You should get this message: *Oracle JDK 8 installed *.

After installing Oracle Java, you need to setup the JAVA_HOME environment variable which should point to where Java is installed.

To set Oracle JDK8 as default, install the "oracle-java8-set-default" package by running the following command:

sudo apt-get install oracle-java8-set-default

You can then either re-open a new terminal or run source /etc/profile in your current terminal to activate the new environment variables.

Installing Android Studio in Ubuntu 18.04

After installing Oracle Java and set it as the default in Ubuntu. You can now install Android Studio by either going to the official website and downloading the ZIP package for Linux 32bit or 64bit. Or install Android Studio from a PPA which is the preferred method that I'm going to show you in this tutorial.

So go ahead and start by adding the PPA ppa:maarten-fonville/android-studio

sudo add-apt-repository ppa:maarten-fonville/android-studio

Next run the update command:

sudo apt update

Finally, install Android Studio by running the following command:

sudo apt install android-studio

This will take some time to download Android Studio and install it.

After installing Android Studio, you can access it from Unity Dash.


In this tutorial, we've seen how to setup a development environment with Java 8 and Android Studio in Ubuntu 18.04 which are required for developing Android applications.

Note: We also publish our tutorials on Medium and If you prefer reading in these platforms, you can follow us there to get our newest articles.

You can reach the author via Twitter:

About the author

Ahmed Bouchefra
is a web developer with 5+ years of experience and technical author with an engineering degree on software development. You can hire him with a click on the link above or contact him via his LinkedIn account. He authored technical content for the industry-leading websites such as SitePoint, Smashing, DigitalOcean, RealPython, freeCodeCamp, JScrambler, Pusher, and Auth0. He also co-authored various books about modern web development that you can find from Amazon or Leanpub

Get our Learn Angular 8 in 15 Easy Steps ebook in pdf, epub and mobi formats, plus a new Angular 8 tutorial every 3 days.

comments powered by Disqus Protection Status