Developers interested in the Android mobile operating system are able to use the Android SDK and various IDE software to code applications. These apps can then be made available and marketed to Android users around the world.
There are a lot of choices when it comes to programming Android applications. Your coding environment can involve a Linux system and a variety of different IDE programs to facilitate all of the software development. The trouble here is that each Linux distribution will often have a different set of requirements to run the sofware, and a separate list of steps that need to be followed.
In this guide, we’ll go through the step by step instructions to install Android Studio – which is one of the most popular Android IDEs – on a Linux system. This will work on any distribution because we’ll be using Snap package manager to manage the installation. Love it or hate it, the Snap package manager gets your system ready for Android development very quickly, by handling all the dependencies and working identically on any distribution you’re running, whether it be Ubuntu, Debian, Red Hat, CentOS, AlmaLinux, openSUSE, or any other type of Linux system.
Follow along with us below as we setup Snap package manager, install Android Studio, and then program a Hello World Android application to verify that everything is working properly.
In this tutorial you will learn:
- How to setup Snap package manager
- How to install Android Studio and SDK packages
- How to create a Hello World test application
- How to run an Android application on an emulated device
|Category||Requirements, Conventions or Software Version Used|
|System||Any Linux distro|
|Software||Snap, Android Studio|
|Other||Privileged access to your Linux system as root or via the
# – requires given linux commands to be executed with root privileges either directly as a root user or by use of
$ – requires given linux commands to be executed as a regular non-privileged user
Install Snap package manager
It’s perfectly possible to install the Android SDK, Android Studio (or a different IDE), and the necessary prerequisites by using your system’s package manager or downloading the software on the web. However, the process for this can vary widely, and we want to make sure that you get up and running with a working Android development environment. Therefore, we recommend using Snap for the installation process, which will handle dependencies for us and run the software in a sandbox.
Newer versions of Ubuntu should already have Snap enabled, as Canonical developed the feature and first introduced it on their own distribution. It’s also available for most other Linux distributions, but must be installed first. If you’re not running Ubuntu, please see our guide on How to setup Snap package manager on any Linux distro to install Snap, then rejoin us here for installing Android Studio.
How to install and use Android Studio
Follow the steps below to install Android Studio, then use it to create your first Android application, a Hello World program that will verify we have a working coding environment.
- Once you have Snap enabled, open a terminal and use the following command to install the Android Studio snap.
$ sudo snap install android-studio --classic
- After Android Studio is done installing, you can open it from your system’s application launcher.
- Since this is your first time opening Android Studio, you’ll need to go through some initial prompts that pop up. It’s just a setup wizard that will take you through a few things, and will also fetch some updates and other dependencies from the web. All of these prompts are easy to follow and self explanatory.
- Note that a hefty amount of software will be downloaded for the Android SDK and its related packages. This could take a little while on slow internet connections.
- Once the setup wizard wraps up, you can click on “Create New Project” to begin coding the Hello World application.
- For a simple test application like this, choosing an empty activity will be most appropriate.
- Fill out your application name, which we’ll just call “Hello World.” The other settings should be fine at their defaults. Normally, you would want to change the “minimum SDK” requirement, but for this first test application, it doesn’t matter much. Click on finish when you’re ready.
- Android Studio will now open your new project. This may take a minute as the background processes (viewable at the bottom of the Android Studio window) finish their job. After everything’s ready, you can click on the
activity_main.xmltab to see how your Hello World application looks. Feel free to make any changes that you’d like. Notice that we don’t have to do any actual coding just for this test application – the hello world text has already been generated for us.
- When you’re ready to launch the program on an emulated device, click the green play button.
- As the emulated phone finishes powering up, your Hello World application should open automatically. This is just a basic application, but more complex apps would allow you to interact with it for more testing.
That’s all there is to it. If your Hello World application executed successfully, you can continue using Android Studio to code other Android applications.
In this guide, we saw how to get started with developing Android applications on a Linux system by installing Android Studio and SDK. We also learned how to create a test application and run the app on an emulated mobile device for testing. This should be enough to get you started with Android app development on any Linux distro.