DEV Community

Cover image for Installing Android Studio On Ubuntu 22.04: Complete Guide
JanetMutua
JanetMutua

Posted on

Installing Android Studio On Ubuntu 22.04: Complete Guide

Are you new to Android Development? And do you want to learn how to setup your Integrated Development Environment (IDE) for building your projects? Then you are in the right place!

Android Studio is the official IDE for developing Android apps. It comes with powerful features that help you build your applications faster and easier.

For Linux users, this guide will take you through the nitty gritty of getting your IDE setup. Let's get started!

System Requirements

Since we are setting up on Linux, here are the system requirements as listed on the Official download page for Android Studio:

  1. x86_64 CPU architecture; 2nd generation Intel Core or newer, or AMD processor with support for AMD Virtualization (AMD-V) and SSSE3.

  2. Any 64-bit Linux distribution that supports Gnome, KDE, or Unity DE; GNU C Library (glibc) 2.31 or later.

  3. A minimum 8 GB of available disk space for your IDE, Android SDK and the Android Emulator.

  4. 8 GB RAM or more.

  5. 1280 x 800 minimum screen resolution.

If your computer meets these requirements then let's get started with the installations.

Method 1:Manually Installing Android Studio (From the Official & PPA Repositories)

Installing From the Official Repository

You can install Android Studio from the official repository. To begin, open up your terminal and then update and upgrade your APT repository by running the command below:



$ sudo apt update
$ sudo apt upgrade


Enter fullscreen mode Exit fullscreen mode

Then install OpenJDK, a free and open-source implementation of the Java platform, Standard Edition (Java SE). To do so run:



$ sudo apt install openjdk-18-jdk


Enter fullscreen mode Exit fullscreen mode

Now you can proceed to install your IDE by downloading a zip file of the latest version of Android studio on your machine.

At the time of writing this article, the latest version of Android Studio is the Electric Eel version. Run:



$ wget https://dl.google.com/dl/android/studio/ide-zips/2022.1.1.21/android-studio-2022.1.1.21-linux.tar.gz


Enter fullscreen mode Exit fullscreen mode

or you can check for the version you want from the Android Studio Download archive

After successful download, you need to unpack the downloaded zip file with:



$ tar -zxvf android-studio-2022.1.1.21-linux.tar.gz


Enter fullscreen mode Exit fullscreen mode

Then move the android-studio folder to /opt/ using:



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


Enter fullscreen mode Exit fullscreen mode

Once you have run these commands, you will write a snippet of code to allow for the Android Studio application to be available on the application menu shortcut on Ubuntu.

Using this command:



$ sudo nano /usr/share/applications/android-studio.desktop


Enter fullscreen mode Exit fullscreen mode

Add the following code snippet and save:



[Desktop Entry]
Version=1.0
Type=Application
Name=Android Studio
Comment=Android Studio
Exec=bash -i "/opt/android-studio/bin/studio.sh" %f
Icon=/opt/android-studio/bin/studio.png
Categories=Development;IDE;
Terminal=false
StartupNotify=true
StartupWMClass=jetbrains-android-studio
Name[en_GB]=android-studio.desktop


Enter fullscreen mode Exit fullscreen mode

From there you can open and run your android studio from the activities or on the applications menu.

Uninstalling Android Studio - Official Repository

If you installed Android Studio from the Official repository, run the following commands to uninstall the IDE:



$ sudo rm /usr/share/applications/android-studio.desktop
$ sudo rm -r /usr/bin/android-studio
$ sudo rm -rf /opt/android-studio
$ rm -rf ~/android-studio-2022.1.1.21-linux.tar.gz


Enter fullscreen mode Exit fullscreen mode

This will completely uninstall all the packages that were installed.

Installing Android Studio From the PPA Repository

You can also get your IDE from the PPA repository - an Ubuntu based software repository. To begin install OpenJDK:



$ sudo apt install openjdk-18-jdk


Enter fullscreen mode Exit fullscreen mode

Check to see the java version installed above:



$ java -version


Enter fullscreen mode Exit fullscreen mode

Then import PPA and update your APT repository using:



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


Enter fullscreen mode Exit fullscreen mode

Once complete, you can install Android Studio through:



$ sudo apt install android-studio -y


Enter fullscreen mode Exit fullscreen mode

Uninstalling Android studio - PPA repository

If you need to remove Android Studio from your machine, run:



$ sudo apt autoremove android-studio --purge -y


Enter fullscreen mode Exit fullscreen mode

Then remove the imported PPA using:



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


Enter fullscreen mode Exit fullscreen mode

With this, Android Studio and all the installed packages will have been removed completely

Method 2: Installing Android Studio Using Snap

Another way you can use to install Android Studio is by using Snap - a package management system by Canonical. To do so, first run:



$ sudo apt install snapd


Enter fullscreen mode Exit fullscreen mode

Then install OpenJDK and Android Studio using:



$ sudo apt install openjdk-18-jdk
$ sudo snap install android-studio --classic


Enter fullscreen mode Exit fullscreen mode

Once done, proceed to launch Android Studio by running:



$ android-studio

Enter fullscreen mode Exit fullscreen mode




Uninstalling Android Studio - Snap

Removing Android Studio installed using snap is quite easy. You simply need to run:



$ sudo snap remove android-studio

Enter fullscreen mode Exit fullscreen mode




Method 3: Installing Android Studio Using JetBrains Toolbox

The third method you can use to install Android Studio is by using the Toolbox app which gives you access to developer products made by Jetbrains.

If you don't know how to install Toolbox, here is a guide on how to.

Once you have Toolbox on your machine, click to open it, then select Android Studio and click install. You will get the latest version of the IDE installed in your machine.

Download Android Studio
If you prefer to install a specific version of Android Studio, you can check the available versions and install the one you prefer.

Android Studio Versions

Uninstalling Android Studio - Jetbrains Toolbox

To remove Android Studio just open the Toolbox App and click the menu button adjacent to Android Studio option to see an uninstall option.

This will remove Android Studio and all the packages that were installed with it.

With that, you can select whichever method suits you and get your IDE setup.

Bonus Tip: Using Wakatime For Your Coding Productivity!

Enhancing your productivity while coding means that you can get more done and build better software. One such plugin that can increase your productivity is Wakatime.

Wakatime is used for time tracking meaning you can manage and analyze how much time you spend coding daily. In the spirit of building in public, Wakatime can help you share your metrics on Twitter or LinkedIn.

What's more, you can include your programming metrics on your Markdown file on Github. Once you have installed Android Studio, head over to Settings/plugins and search for Wakatime.

Install it and restart your IDE, then go ahead and change the world one minute at a time!

References

Android Studio download archives
Latest version of Android Studio
Ubuntu-Server.com

Conclusion

In this guide we have covered three ways of installing the Android Studio IDE. Properly setting up your IDE allows you to develop your applications smoothly with no bumps. I hope this article has been of help to you.

Follow me on Twitter and Medium for more tutorials and guides.

Keep building! 🌟

Top comments (2)

Collapse
 
brainuts profile image
brainuts

StartupWMClass=jetbrains-studio is the correct one in desktop entry file!

Collapse
 
gabrieladnz profile image
Gabriela Diniz

Thanks!