A screenshot of Android Studio while it is loading up

How to Install Android Studio in Ubuntu/Linux

The Android OS definitely needs no introduction: it powers over 80% of all smart phones in the world right now. And one of the reasons why it is so popular is that the Android OS has an enormous amount of (free) apps available for its users. So if you’re seeking to author a new, awesome app, and you use Ubuntu or another Linux-based operating system, you’re in the right place. We’ll get you started on your Android app development journey by teaching you how to install Android Studio.

 

What is Android Studio?

Android Studio is the official Integrated Development Environment (IDE) for Android apps. It is the core software that software developers (you and I) use to create, debug and improve great Android apps. To put it another way, Android Studio is like a multi-functional oven: you give it all the ingredients and cooking instructions for your desired cherry pie and it gives you the finished product. However, installing and setting up Android Studio is a bit of a hassle because you have to set up some other software that don’t come bundled with Android Studio but which it needs before it can cook your pie e.g Android SDK, Android Build Tools, Android Platform Tools etc. So, here is a complete tutorial on how to properly install and set up Android Studio on your Ubuntu computer. Note, however, that the wisdom herein should work for most of the Ubuntu derivatives and other Linux distros out there like Debian (for sure, and for its children too), Fedora, openSUSE, CentOS etc.

 

REQUIREMENTS

  • Java 8 or later must be installed. Note that you need Oracle Java and not OpenJDK. You can follow this tutorial to install it on your Ubuntu/Linux machine. Otherwise, you need to use Google to find out how to install Oracle Java 8 or later for your particular Linux distro.
  • a strong internet connection.
  • more than 5GB of space on your hard drive/SSD.

If you have the above, we can commence the installation tutorial. Note that I’ve separated the entire process into a few stages. These stages are like milestones in the installation process, to help you gauge your progress easily. That said, let us begin!

Stage 1: Download Android Studio

  • Download the latest Android Studio installation archive for Linux from this link. Note that you might have to scroll down the page in order to find the link for the installation archive.
  • Open a terminal and navigate to where you put the installation archive. If you saved it in your Downloads folder, you can navigate to that directory using this command:
    cd ~/Downloads
  • Now let’s say the name of the Android Studio installation archive is android-studio-ide-143.2915827-linux.zip. Extract it to a folder named android-studio in your home directory with this command:
    unzip android-studio-ide-143.2915827-linux.zip -d ~/android-studio
  • Android Studio is a very important piece of software which we don’t want any other software to mess with, either accidentally (like Bleachbit) or maliciously (like malware, obviously). So, we’re going to move it to a write-protected folder, one that requires the approval of the Prime Minister of a computer before it can be changed. You can do that by entering the following:
    sudo mv ~/android-studio /usr/local/

    You might need to supply the password for the root user after entering the command above because of the use of sudo.

  • Enter the following in your terminal in order to run Android Studio’s startup script:
    ./usr/local/android-studio/bin/studio.sh

    Since this is the first time you’re running it, the script will guide you through some steps on installing/setting up Android Studio.

  • If you have a lot of Internet bandwidth, you can use the “Standard” option during the installation. This will automatically download and install the Android SDK and some other packages, so you can skip stage 2 and move on to stage 3. Otherwise, disconnect from the Internet at this step and use the “Custom” option. The download will fail and after it does, click finish. Now move on to stage 2…

 

Stage 2: Install Android SDK

  • Download the latest Android SDK installation archive for Linux from this link. The archive was about 311 MB when writing this.
  • Open a terminal and navigate to where you saved the above archive. If you saved it to your Downloads directory, you can navigate to that location by entering this command:
    cd ~/Downloads
  • Let’s say the name of the Android SDK installation archive is android-sdk_r24.4.1-linux.tgz. Extract the downloaded archive to a directory called android-sdkin your home directory with this command:
    tar -xvzf android-sdk_r24.4.1-linux.tgz ~/android-sdk
  • Next, move the extracted SDK to /usr/local by entering the following:
    sudo mv ~/android-sdk /usr/local/
  • Now re-run the Android Studio startup script by entering this in the terminal:
    ./usr/local/android-studio/bin/studio.sh
  • On the page titled “Welcome to Android Studio”, look to the bottom right and navigate to Configure -> Project Defaults -> Project Structure.
  • In the dialog for Android SDK location, point it to the directory where you extracted the SDK in the steps above i.e /usr/local/android-sdk.

However, you still can’t build apps yet as the setup isn’t complete. In the words of Google
itself, “The Android SDK archive initially contains only the basic SDK tools. It does
not contain an Android platform or any third-party libraries. In fact, it
doesn’t even have all the tools you need to develop an application.” (Source: /usr/local/android-sdk/SDK\ Readme.txt)

Now we move on to stage 3…

 

Stage 3: Install Android Build Tools and

Android Platform Tools

  • In the terminal, enter the following:
    cd /usr/local/android-sdk/tools
  • Then, start the UI of the Android SDK Manager by entering this:
    ./android
  • Next, you need to install Android Build Tools and Android Platform Tools. You can choose any tools you want, but the essential ones are:
      • Android SDK Tools.
      • Android SDK Platform-tools.
      • One or more of the Android SDK Build-tools. Each one is for a version/API Level of Android like KitKat (API Level 19), Ice Cream Sandwich (API Levels 13 and 14) etc. Please consult this link for a list of all Android versions and their corresponding API levels.
      • The SDK platform for each of the Build tools you chose above. For example, the SDK platform for “Android SDK Build Tool, Rev 19” is under “Android 4.4.2 (API 19)”, the SDK platform for “Android SDK Build Tool, Rev 20” is under “Android 4.4W.2 (API 20)” etc.
      • Note: make sure you download the Build Tools and Platforms for the Android versions that are the target market for your app. Consult this link if, just like me, you don’t know all the Android API levels off the top of your head.

CONCLUSION

Installing Android Studio on Ubuntu/Linux is not a brief process, but if you follow the instructions above, you can still get it installed easily. Nonetheless, please let me know in the comments below if you encounter any trouble using the instructions above.

Having completed the set up of Android Studio, do go ahead to create your awesome new app! You can consult the official Android docs (especially this link) if you need any help with that.

Yonde kurete arigatō!

Drop a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.