How To Install Android Studio On Ubuntu 18.04

By bhagwatchouhan
How To Install Android Studio On Ubuntu 18.04

Android Studio is the official IDE supported by Google to develop Android applications. It's based on the IntelliJ IDEA which is being widely used for Java development. It offers a powerful code editor and developer tools. The Android Studio includes Gradle to manage dependencies and build the applications. It also provides several pre-configured templates to rapidly start the development.

Android Studio also ships with built-in support for Google Cloud Platform, which makes it easy to integrate Google Cloud Messaging and Google App Engine.

In this tutorial, we will discuss all the steps required to install Android Studio on the popular Linux distribution i.e. Ubuntu with Java 8. It shows the steps required for Ubuntu 18.04 LTS, but the process should be similar for other Linux distributions. This tutorial assumes that you have installed Android SDK by following How To Install Android SDK Tools On Ubuntu. You can also continue this tutorial to have a fresh install of Android Studio.

Notes: You may follow the installation instructions from How To Install Java 8 On Ubuntu to install Java 8. You may also be required to execute the below-mentioned command in case you have set the options previously for Java 9 or Java 10. You may also follow How To Install Android Studio On Windows.

# The saviour command
unset JAVA_OPTS

 

Download Android Studio

Download the most recent version of Android Studio from the official website. The download page looks like the one as shown in Fig 1.

Android Studio Download

Fig 1

Click on the Download Button to start downloading Android Studio. It will ask to agree on terms and conditions as shown in Fig 2.

Android Studio Agreement

Fig 2

Agree with the terms and conditions and click on the Download Button to start the download.

 

Install Android Studio

Extract the download to the appropriate location having sufficient space. The installation needs at least 1.5 GB of disk space. We will install the GNOME panel and use the same to create a desktop shortcut to execute the Android Studio installed by us.

# Refresh Package indexes
sudo apt-get update
# Install GNOME Panel sudo apt-get install --no-install-recommends gnome-panel
# Create Desktop icon gnome-desktop-item-edit ~/Desktop/ --create-new

Now configure the Studio installation as shown in Fig 3. We will use the Studio executable and icon available in the bin directory of the installation directory to create the desktop shortcut.

Android Studio Shortcut

Fig 3

Click on the OK Button to create the desktop launcher.

 

Android Studio Setup

Execute the installer to start the installation. It will ask for system permission as shown in Fig 4.

Android Studio Permission

Fig 4

Click on the Trust and Launch Button to permit the launcher. It will also ask to import settings from the previous installation as shown in Fig 5.

Android Studio Setting

Fig 5

I have opted for Do not import settings Option as shown in Fig 5. Click on the OK Button to continue the setup. It will ask for permission to collect usage statistics as shown in Fig 6.

Android Studio Data Permission

Fig 6

I have opted to send usage statistics to Google. You may avoid it by clicking on the Don't send Button. It will show the Welcome Screen as shown in Fig 7.

Android Studio Welcome

Fig 7

Click on the Next Button to continue the installation. The next screen shows the options to choose Install Type as shown in Fig 8.

Android Studio Type

Fig 8

Click on the Next Button to continue the installation. It shows the next screen to choose the theme as shown in Fig 9.

Android Studio Theme Selection

Fig 9

Click on the Next Button to continue the installation. The next screen provides options to choose components as shown in Fig 10.

Android Studio Components

Fig 10

You can choose the components for a fresh installation of Android SDK. I have opted to use the Android SDK installed in the previous tutorial How To Install Android SDK Tools On Ubuntu.

Click on the Next Button to continue with the setup. It shows settings screen to verify the settings done by us as shown in Fig 11.

Android Studio Verify Settings

Fig 11

Click on the Next Button to confirm Emulator Settings as shown in Fig 12.

Android Studio Emulator Settings

Fig 12

Click on the Finish Button to start downloading components. The setup will download the components in case it's fresh installation or need an update of Android SDK. Since I have had the most recent installation of Android SDK, the download screens look like the one as shown in Fig 13.

Android Studio Download Components

Fig 13

Click the Finish Button to complete the setup and launch Android Studio. The next screen provides options to create a new project or import an existing project as shown in Fig 14.

Android Studio Welcom Screen

Fig 14

Click on the Start a new Android Studio project to start creating the Hello World project. The new screen provides options to choose a project template as shown in Fig 15.

Android Studio Project Template

Fig 15

I have selected a blank template as shown in Fig 15. Click on the Next Button to configure the Hello World project as shown in Fig 16.

Android Studio Project Configuration

Fig 16

You can select your preferred language to develop Android applications among Java or Kotlin. I have selected Java as part of this tutorial. The next screen shows the HelloWorld application with default workspace as shown in Fig 17.

Android Studio Workspace

Fig 17

 

Hello World

We will create our first activity as the starting point of the application. Right click on the app -> Hover On New -> Hover On Activity -> Click on Basic Activity. An activity configuration screen will be displayed as shown in Fig 18.

Android Studio Create Activity

Fig 18

I have kept the values suggested by the Android Studio for the main activity as shown in Fig 18. Click on the Finish Button to create the activity. It will open the Main Activity Class Tab and Layout Editor of Main Activity content as shown in Fig 19.

Android Studio Activity Layout

Fig 19

Now click on the TextView component and drag it to the center of the screen. Also, update the text value from the Common Attributes Panel as shown in Fig 20.

Android Studio Text View

Fig 20

We also need to update the AndroidManifest.xml file to configure the default activity as shown in Fig 21.

Android Studio Manifest

Fig 21

 

Create AVD

In the previous steps, we have installed Android Studio and completed the setup. We have also created the Hello World project as part of the setup process. In the previous step, we have also added the main activity and configured the manifest file to use it while launching the app. In this step, we will create an AVD to deploy the app to the virtual device.

Click on Tools -> AVD Manager to launch the AVD manager as shown in Fig 22.

Android Studio AVD Manager

Fig 22

Click on the Create Virtual Device Button to start creating AVD as shown in Fig 23.

Android Studio AVD Configuration

Fig 23

Now click on the Next Button to choose the image as shown in Fig 24.

Android Studio AVD Image

Fig 24

Click on the Next Button to configure the virtual device as shown in Fig 25.

Android Studio Verify Image

Fig 25

Now click on the Finish Button to launch the virtual device. It may take some time based on your system hardware. The AVD will start and show the Home Screen as shown in Fig 26 and Fig 27.

Android Studio AVD Launch

Fig 26

Android Studio AVD Home

Fig 27

If you can see the home screen - Congratulations on launching your first virtual device from Android Studio.

 

Launch App

In this step, we will run and deploy the Hello World application to the virtual device created by us in the previous step. Click on Run -> Run App or press Shift + F10 to build and deploy the application to AVD. It will show the success message on the console as shown in Fig 28.

Android Studio Run App

Fig 28

You can also check the AVD displaying the application home screen as shown in Fig 29.

Android Studio App Home

Fig 29

This is how we can install Android Studio, create the project, add an activity, create the virtual device, and deploy and launch the application on the virtual device.

Share this blog:

Profile picture for user bhagwatchouhan
bhagwatchouhan