Live demo
See our new Code Review Agent in action
December 18
Home / Blog /
How to install Android Studio on Ubuntu (step-by-step guide)
//

How to install Android Studio on Ubuntu (step-by-step guide)

//
Tabnine Team /
5 minutes /
February 18, 2019

If you’re an Ubuntu user developing an Android app, or an open source enthusiast looking to tinker with the OS without bricking your device, the official Android Studio IDE (integrated development environment) from Google is a piece of software you need to install. This guide will walk you through the installation process of Android Studio on Ubuntu 16.04/17.10/18.04, and is suited for users of all levels.
Like with most actions and applications on any Linux machine, there are multiple ways to install Android Studio on Ubuntu. Included in this guide are the most straightforward couple:

    1. Mostly GUI – Through the Ubuntu Software Center
  1. Classic – From the official website

Minimum System Requirements:

To run Android Studio smoothly on your machine, you will need:

    • 4 GB of Disk Space
    • 8 GB of Memory
    • Screen resolution of 1200 x 800 or higher
  • 64 bit OS architecture capable of running 32-bit type applications

Installing Java for Android Studio:

Before you install the Android Studio IDE, you need to make sure your Ubuntu installation is armed and ready with the recommended Java development kit for Android Studio – Oracle JDK.
To check the version of Java currently running on your machine, use the terminal to run the following command:

java --version

If you don’t have Java installed, the output should be something like:

Command ‘java’ not found, but can be installed with:
sudo apt install default-jre
sudo apt install openjdk-11-jre-headless
sudo apt install openjdk-8-jre-headless

Java version check
This is Ubuntu giving you hints on how to set up one of the default Java engines on your machine. Since Android Studio can be finicky about its Java, we’re going to ignore these options and install the Oracle JDK with the following commands:

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

Oracle Java Install
The download may take some time, so depending on your internet speed, this might be a good time to get some Java (or other caffeinated beverage) of your own. Once the download and installation are done, make sure to set the Oracle Java as the default:

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

Next, verify the installation by typing:

javac --version

The result you should get is something like:

javac 1.8.0_201

Make sure to note the path of your Java installation. If you followed the instructions above, it will be /usr/lib/jvm/java-8-oracle/bin .
Finally, you will need to set the JAVA_HOME environment variable in Ubuntu to the location of your JDK installation. To do that, you will need to edit the .bashrc file. Switch to root by typing:

sudo su

To edit the bash file, enter:

gedit .bashrc

Edit bash
At the very end of the file, after the last fi, add the following lines:

JAVA_HOME=/usr/lib/jvm/java-8-oracle/bin
export JAVA_HOME
PATH=$PATH:$JAVA_HOME
export PATH

Save the bash file, restart the terminal, and type echo $JAVA_HOME to make sure the path is properly set.
Echo Java_home

Installing Android Studio From The Ubuntu Software Center

Linux is traditionally used in CLI (command line interface) mode (or terminal), but Ubuntu is working hard to make Linux accessible even to those of us raised on Windows and Mac and unused to typing commands. Part of that effort was including popular software packages and apps in the Ubuntu version of the app store – the Software Center – in the form of Snap packages. The installation process is really as easy as it gets.
ubuntu hacker guy
Locate the Ubuntu Software Center icon in your taskbar and use the search functionality to find Android Studio. Click install and let it download and run initial setup.
Ubuntu Software Center
Once done, click Launch to run the Setup Wizard and proceed to download additional components and packages to complete the installation. Note that this too may take some time (depending on the speed of your connection and components you chose to install) so go ahead and grab another cup of coffee.
Upon completion, you will be able to start using Android Studio with a new or existing project.
android studio welcome

Installing Android Studio From The Official Website

If you prefer the official download over the community-maintained Snap, you can download and install Android Studio manually and according to the instructions released by Google.
Start by downloading the Linux package of Android Studio from the Google website. Yup, it’s time to get some coffee while the 1 GB file downloads.
Right click the zip file in the file browser and choose “Extract Here”. You can move the file out of the Downloads folder later, if you wish.extract file android studio installation ubuntu
Navigate to the android-studio/bin/ directory, and open a terminal by right clicking and choosing “Open in Terminal”.
In the terminal, execute studio.sh by entering:

./studio.sh

If you have previous Android Studio settings you’d like to import, select them now. If not, proceed with new setting and click OK.
The Setup Wizard will launch, and proceed to download additional components and packages to complete the installation. Note that this too may take some time (depending on the speed of your connection and components you chose to install) so go ahead and grab another cup of coffee.
Once all the components you selected finish downloading, the app will launch and you can start working on your code.
welcome to android studion 2

Add to Desktop

To make sure you can access the app quickly and without the terminal, choose “Configure” on the bottom right and “Create Desktop Entry”.
Create desktop entry
Caffeinated enough from the download and installation process? Good! Now get coding.