Android Studio has many tool windows to assist in your development process. Some are inherited from IntelliJ IDEA, while others are unique to Android development or the Gradle build tool. You can get to tool windows by clicking the tabs that surround the interface, by moving the mouse to the lower left corner and selecting from the menu that pops up, or from the View menu.
- [Voiceover] Android Studio has a rich set of windows that provide tools for navigating the user interface and executing various development tasks. I'll describe each of these windows in turn, including what they're for, and a little bit about how to use them. I've already described the project window that offers a variety of hierarchical views of your files and folders. To get to other windows, you can use the tabs around the edges of the interface, or you can move the cursor down to the lower left, and as it hovers over that icon, a list of available windows will pop up, or you can go to the menu and choose view, tool windows, and see a list there.
Not all of these windows are enabled. Some of them just aren't appropriate for the current state of my development process. The debug window is only useful when I'm actually in a debug session, and version control is only activated after I've configured a project for use with the version control system, such as Git. But many of these other windows can be very useful as you develop your app. The structure view is available on the left side, and through the keyboard shortcut command, seven on Mac, or alt, seven on Windows.
It shows a structured view of your Java classes. By default, it shows a list of methods, and they're displayed by default in the order of declaration. You can sort them alphabetically by clicking on this icon here, or you can sort them by visibility, that is by their access modifiers. You can also determine what members of the class are going to be displayed. By default, you're showing fields and non-public members. But you can turn off that option and hide the non-public members, and now I'm only seeing public methods.
I'll turn that method back on, and there's all the methods again. This class doesn't have any fields yet, so I'll add one. I'll add a constant. Now, there is no const keyword in Java right now, but there is something called a live template in Android Studio. I'll type const and press tab, and that expands to a private static final integer field. I'll just name it value, and then I'll make sure that the fields option is clicked here, and I see the field appears.
Now I can move the cursor anywhere in the class, but then I can return to the field by just single clicking it in the structure window. The captures window is next. This window doesn't show anything by default, but as you use various monitor tools in Android Studio, such as the memory or CPU monitor, you can save your results into this captures window and get back to them later. The build variance window lets you manage your build process. By default, you're using something called the debug variant, but there's also the release variant, and you'll use that when you package your app for deployment.
The favorites window gives you a way to get to the classes and other resources that you use most frequently. By default, you'll see three lists available, one for your project, one named bookmarks, and one named breakpoints. You can add items to the list through the project window. I'll go to my project window. And then look for my main activity class in my base package. I'll right click on it and choose add to favorites, and then choose the hello world list.
I see a little spinner icon appear here, and there's my class. Now, I'll right click on this tab and choose close all. And then I'll go back to favorites and double click, and there's my class. You can add as many items to the favorites window as you want to to manage your application. The messages window isn't visible right now, but it's worth looking at. To see it, I'll clean the project. And it appears down here. You can get to the messages window with alt or command and zero.
This displays a listing of messages from the Gradle build tool. If you have trouble building your application, you can find errors and warnings from Gradle here. These errors and warnings are different from the ones that appear in the project window in the problems scope. Items that appear here are Java coding errors, typically. Information that shows up in the messages window typically is discovered only when you try to compile and package the application. The to do window shows you a list of all of your to do comments.
Here's an example. Let's say that I wanted to make a note to myself to implement something in this on stop method. I would start with a comment, press command and the forward slash key on Mac, or control slash on Windows. Then type todo, all one word. It doesn't matter what you type after the to do. By simply including that text, this comment is now included in your to do window. I'll close the main activity class. Then I'll go to this window, and then double click on the comment, and the file is opened and the cursor lands on the comment.
You can also filter your to do listings with these tabs, showing only to dos in the current file, or based on a particular scope. And the scope list is here. The Android monitor window gives you access to log cad output from your devices, and any logs that are generated by the Android debug bridge, or ADB. The log cad tab is the default, but you can also get to this monitors tab. By default, there's only the memory monitor, but if you double click, it'll open up and show you the CPU, network, and GPU monitors as well.
These will only be activated when you're actually running an app on a virtual or physical device, but they're very, very useful in tracking what's going on on the device as you run your app. Whenever you run your application, the Android monitor window will open automatically. If you don't like the visual interruption, just click and drag down and hide most of the monitor. The terminal window opens a command prompt. On Windows it opens a simple command prompt, and on Mac it opens an instance of the terminal application.
You can run any commands here that you can run on your operating system. I'm working on Mac, so I can do a directory listing with LS. On Windows, you'd use DIR. You don't have any special paths set up when you open this window. I've already added my Android STK's tools and platform tools directories to my system path. So when I type ADB, devices, I get a listing of my attached devices, my emulator, and my physical device. If you haven't added these directories to your system path, you won't get the same results on your computer.
If you want to add those directories to your path, you'll need to do it outside of Android Studio, and follow the steps for your particular operating system. I describe how to do that in the course "Android App Development Essential Training." Over on the right, there's also the Gradle window, and the Android model window. These are also worth exploring, but I think you'll find that you don't use them as much on a day-to-day basis, and I won't cover them in detail right now. Some of these windows are critical for all Android developers, such as the editor and the project window.
Some of the other windows depend on how you do your development on your particular process. But I encourage you to investigate and play with these tool windows, and read about them in the documentation to see if they can help you get your work done more quickly and more efficiently.
- Installing Android Studio on Mac and Windows
- Creating Android Studio projects
- Setting up the development environment, including HAXM and the new Android emulator
- Importing existing code into Android Studio projects
- Exploring the interface, including the editor and project windows
- Managing project builds and dependencies
- Creating new Java classes
- Refactoring code
- Using templates
- Using breakpoints and watch expressions
- Updating apps with Instant Run
- Using Git for version control
Skill Level Beginner
Q: This course was updated on 04/27/2017. What changed?
A: New videos were added that highlight the new features introduced in Android Studio 2.3. In addition, the following topic was updated: update apps with Instant Run.