DEV Community

Adam McNeilly
Adam McNeilly

Posted on • Edited on

Setting Up Android Tooling

This post serves as a walk through for getting up and running with Android Studio. The purpose it should serve is to get started with your tooling and make sure you can run the default application. As a student, you can use this to make sure your tooling works correctly before jumping into development. As a mentor, you can send this to students to get setup prior to a workshop.

Disclaimer: The first iteration of this post was written on an Apple MacBook that already had the Android SDK installed. If you encounter any new steps, or find something specific to Windows, please let me know in the comments and I can update the post accordingly. As information comes in, I'll add it where it's relevant.

Let's dive in.

Downloading Android Studio

You can download the latest version of Android Studio here: https://developer.android.com/studio/

Once you click the download button, the installer will appear in your downloads just like any other program. Once this is done, you can follow the setup wizard as you would for any other program - so I've opted not to write about that here. If you experience any issues with this step, please let me know in the comments!

Linux Download

Pointed out in the comments, there's some additional steps after the install on Linux that you must follow.

  1. Extract the archive that was downloaded in any way.
  2. The resulting folder will be in android-studio if extracted via terminal, or android-studio-ide-xxx if extracted via a right click.
  3. Move that folder to a preferred location. This may be /user/local or /opt.
  4. To install, enter the directy /opt/android-studio/bin (or wherever you moved it in step 3) and run ./studio.sh. This will launch the setup screen from the next session.
  5. When the setup wizard is done, go to Configure > Create Desktop Entry to be able to launch Android Studio like other apps instead of via the terminal.

You can find a video on the Linux install here.

Setup Android Studio

The first time you open Android Studio, there are some steps you will need to follow.

First, we need to go through the Android Studio setup wizard.

Next, we choose the install type. Let's keep it simple with the standard install.

Then, we get to choose a theme. I'm partial to Darcula and other dark editors, but this decision is completely up to you.

Last, we get to verify all of our settings, and click finish.

This will then take a moment to complete the setup, and you'll be greeted with the Android Studio landing page.

Creating Your First Project

This section isn't going to walk you through how to build an app. It is, however, going to show you how to create a bare bones application that you can run on a device to make sure the tooling works.

Once you've hit the landing page that we've seen above, we can click the button to create a new project. From there, we can name our project, give it a package name, and choose if we want any additional language support. The default is Java, but we could also chose to build an app in Kotlin.

Next, we need to determine the minimum API version of our application. This defines the earliest version of Android that our application can run. The community can be very divided on this, but for the intents and purposes of testing our tooling you can pick whatever you want.

Now it's time to pick a template. This template will be used for the activity you create, and can fill in boilerplate for things like a navigation drawer, a login activity, or something else. Here, let's just select empty activity to keep it simple.

Naming your activity can be relevant to your project. You should give it a name that reflects what it's doing. However, since this is solely about getting up and running, you can leave the defaults.

After clicking through that, Android Studio will do a gradle build in the background, and soon it will open up to your project.

Emulator Setup

Having created a project, the next step is to be sure you can run it. This section shows how to do so with an Android phone emulator. For information on how to do it with a physical device, see the next section.

Let's start by opening up the AVD Manager (Android Virtual Device).

You'll be greeted with a landing page that explains you have no devices set up, and prompts you to add one.

In this menu, you'll select a type of phone to emulate.

Next, we need to pick an operating system for our phone to run on. You may need to download the appropriate SDK first.

You can customize the emulator's name and launch configurations, but let's move forward with the defaults.

Now we can see a list of our devices. We can use the little run icon to start our emulator.

Next, we can go back into Android Studio and find the run icon for the project.

Clicking this will bring up a list of connected devices. Selecting our emulator, we should then see the default application running.

Congrats! Now you're ready to start learning Android development, or follow along in your first workshop. As stated in the beginning, please let me know in the comments if you find any hiccups along the way.

Setting Up A Physical Device

In order to run an Android application on a physical device, you must first turn on USB debugging. If you've never done this before, follow these steps:

  1. Go into settings.
  2. Select "System".
  3. Select "About Phone".
  4. Scroll down to "Build Number".
  5. Tap "Build Number" 7 times.
  6. Back out into "System" and you will see "Developer Options".
  7. Select "Developer Options" and find the switch to turn on "USB Debugging."

Once you've done that, if you go back into running your application from Android Studio, you should see your physical device appear alongside the emulator:

Congrats! Now you're ready to start learning Android development, or follow along in your first workshop. As stated in the beginning, please let me know in the comments if you find any hiccups along the way.

Top comments (5)

Collapse
 
sduduzog profile image
Sdu

Lovely post. I think you should also mention the installation part for Linux. As its slightly different

Collapse
 
adammc331 profile image
Adam McNeilly

Thanks Beautus! Do you know where the setup is different/any way you have screenshots? I would love to update the post accordingly, but I don't have a Linux machine to verify.

Collapse
 
sduduzog profile image
Sdu • Edited

Ok Ok after downloading android-studio-ide-xxx-linux.zip (xxx being version numbers idk)

  • Extract the archive in any way (terminal or by right click options)

  • The resulting folder will be android-studio (if right clicked, its gonna be inside android-studio-ide-xxx` )

  • Move that folder to any preferred location

    • Either to the (/usr/local) directory or /opt shared directory (I prefer /opt)
    • On the terminal sudo mv ~/Downloads/android-studio /opt

For x64bit machines

Install 32 bit libraries by
sudo apt-get install libc6:i386 libncurses5:i386
libstdc++6:i386 lib32z1 libbz2-1.0:i386

  • To install:
    • cd /opt/android-studio/bin and then execute ./studio.sh
    • This launches the usual setup screen

  • Last step, when the setup wizard is done, Go to Configure > Create Desktop Entry to be able to launch android studio like other apps instead of the terminal.

I'm sorry I couldn't get screenshots but I got their official video

Thread Thread
 
adammc331 profile image
Adam McNeilly

Thank you so much! I've updated by adding a sub section to the larger download section.

I didn't quite follow your second bullet about moving the folder and running apt-get, can you clarify what that means?

Thread Thread
 
sduduzog profile image
Sdu

I've edited the comment. I think my markdown was a bit off so some things weren't clear enough, it even cut some text without wrapping it.

mv <file or folder to move> <destination directory> a command for moving files
and sudo means you wanna execute a command with root privileges so it prompts for a password before it executes.

android studio can be run from anywhere really but its neater if its put in a directory that wont be disturbed by users. and the mentioned locations are perfect for that.

apt-get or apt is a package tool for linux ubuntu (and some other linux distros). The command is for installing all the libraries listed after the keyword install separated by spaces with this package manager. If you are running a 64-bit version of Ubuntu, you need to install these.

I hope this is helpful really, do ask if you're still need more clarification