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 has many features such as:
- Visual layout editor which can be used to build complex layouts visually and generates code with
- Intelligent code editor which helps developers completing code for Java, Kotlin and C/C++.
- Fast emulator for quickly running and testing Android applications.
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
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 DEV.to. If you prefer reading in these platforms, you can follow us there to get our newest articles.
You can reach the author via Twitter:Follow @ahmedbouchefra
About the author
Read our other tutorials
- Angular Tutorial
- Laravel 6 Tutorial
- React Tutorial
- React Hooks Tutorial
- React Native Tutorial
- Webpack Tutorial
- PHP Tutorial
- Django Tutorial
- Java Spring Tutorial
- Rails 6 Tutorial
- Ionic 4 Tutorial
- TypeScript Tutorial
- Bootstrap 4 Tutorial
- Electron Tutorial
- Cordova Tutorial
- HTML Tutorial
- GraphQL Tutorial
- CSS Grid Layout Tutorial
- PWA Tutorial