The following is the first few sections of a chapter from The Busy Coder's Guide to Android Development, plus headings for the remaining major sections, to give you an idea about the content of the chapter.

Getting Around Android Studio

Eclipse has been around for a very long time and has proven to be a very popular IDE. As a result, there is quite a bit of material written about it, from books and blogs to Stack Overflow questions and official project documentation.

Android Studio shares a lot of functionality with its parent, IntelliJ IDEA. However, IDEA itself has not achieved Eclipse’s level of popularity, even though it has long been the IDE of choice for many “power developers”. And Android Studio’s changes to IDEA are largely undocumented.

Hence, this chapter will serve as a quick tour of the Android Studio IDE, to help you get settled in. Other Android-specific capabilities of Android Studio will be explored in the chapters that follow.

Navigating The Project Explorer

After the main editing area — where you will modify your Java source code, your resources, and so forth — the piece of Android Studio you will spend the most time with is the project explorer, usually available on the left side of the IDE window:

Android Studio Project Explorer, Showing Android Project View
Figure 36: Android Studio Project Explorer, Showing Android Project View

This explorer pane has two main “project views” that an Android developer will use: the Android project view and the classic project view.

Android Project View

By default, when you create or import a project, you will wind up in the Android project view.

In theory, the Android project view is designed to simplify working with Android project files. In practice, it may do so, but only for some advanced developers. On the whole, it makes the IDE significantly more complicated for newcomers to Android, as it is rather difficult to see where things are and what relates to what.

We will return to the Android project view a bit later in the book and explain its benefits relative to resources and Gradle’s sourcesets.

However, for most of the book — most importantly, for the tutorials – we will use the classic project view.

Classic Project View

To switch to the classic project view, click the pair of arrowheads to the right of the “Project Files” tab just above the tree in the explorer, and choose Project:

Android Studio Project Explorer, Showing Project View Drop-Down
Figure 37: Android Studio Project Explorer, Showing Project View Drop-Down

This will change the contents of the tree to show you all of the files, in their associated directories:

Android Studio Project Explorer, Showing Classic Project View
Figure 38: Android Studio Project Explorer, Showing Classic Project View

This project view is much like its equivalent in other IDEs, allowing you to find all of the pieces of your Android project. We will be exploring what those pieces are, and how their files are organized in our projects, in the next chapter.

Context Menus in the Explorer

Right-clicking over a directory or file in the explorer will give you a context menu with a variety of options. Some of these will be typical of any sort of file manager, such as “cut”, “copy”, and/or “paste” options. Some of these will be organized according to how IntelliJ IDEA manages application development, such as the “Refactor” sub-menu, where you can rename or move files around. Yet others will be specific to Android Studio, such as the ability to invoke wizards to create certain types of Android components or other Java classes.

Opening Files from the Explorer

Double-clicking on a file usually opens that file in a tab that allows you to edit that file, using some sort of editor.

Some file types, like images, can be opened but not edited, as Android Studio does not have editors for all file types.

Running Projects

Of course, as you change your app, you will want to try it out and see if it works, whether on a device or an emulator.

The Basics

As noted in Tutorial #2, to run your project, just press the Run toolbar button:

Android Studio Run Controls, Showing Green Arrow to Run the App
Figure 39: Android Studio Run Controls, Showing Green Arrow to Run the App

You will then be presented with a dialog indicating where you want the app to run:

Android Studio Device Chooser Dialog
Figure 40: Android Studio Device Chooser Dialog

The “Connected Devices” category lists any devices or running emulators that the build tools can find. Some may be disabled due to compatibility issues, such as having an emulator for an old version of Android where your app requires a newer version of Android.

The “Available Emulators” category lists all AVDs that you have defined in the AVD Manager that are not already running. Again, you may find that some are disabled for compatibility reasons.

The “Create New Emulator” button brings up the wizard to create a new AVD, just like the one you can launch from the AVD Manager.

“Instant Run”

Next to the green “run” arrow button in the toolbar is a lightning bolt button. Sometimes, this will be grayed out and unusable. Other times, it will appear in yellow:

Android Studio Run Controls, With Instant Run Enabled
Figure 41: Android Studio Run Controls, With Instant Run Enabled

This button performs what is called “Instant Run”. Instead of building your app and pushing the app to the device or emulator, Instant Run attempts to patch your existing app based on whatever changes you made to the project since you last ran it.

On the plus side, Instant Run is very fast. However, the patched app is not exactly the same as would be your app built from scratch. Feel free to use this for smaller changes if you wish.

Viewing Output

The preview of this section is off trying to sweet-talk the Khaleesi into providing us with a dragon.

Accessing Android Tools

The preview of this section is en route to Mars.

Android Studio and Release Channels

The preview of this section apparently resembled a Pokémon.

Visit the Trails!

The preview of this section was lost due to a rupture in the space-time continuum.