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:
- Mostly GUI – Through the Ubuntu Software Center
- 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:
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
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
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:
The result you should get is something like:
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:
To edit the bash file, enter:
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.
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.
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.
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.
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.
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:
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.
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”.
Caffeinated enough from the download and installation process? Good! Now get coding.