Setting Up Android Tooling

Adam McNeilly - Oct 2 '18 - - Dev Community

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.

. . . . . . . . . . . . . . . . . . . . . . . .
Terabox Video Player