You often need to perform the same steps when creating applications. Things like debugging, building, searching for incomplete components, and so on. In this topic, you will learn about the dedicated tools provided by Android Studio to make these tasks easier.
Standard window view
Android Studio has lots of tools that you can use in your project. However, most of them are hidden by default, and you will initially be presented with a screen similar to the one shown below:
Since the Android Studio Flamingo update, projects are set to use Compose by default. This course focuses on the XML approach. To achieve the most similar look to the screenshots in this topic, choose a "Views Activity" in the "Create Project" wizard.
It can sometimes be hard to find the specific tool you're looking for. But fortunately, Android Studio provides the Tool Windows submenu (found under the View menu), which contains a complete list of all the available tools:
Each tool window is located in one of Android Studio's sidebars (found in the corners of the main window). When selected, a tool window will open in the relevant part of the screen, and the tab containing its name will be highlighted in black (colors may vary in other designs):
There is a settings icon in the top right-hand corner of each tool window. And, if you click on it, a small list of possible actions will appear:
View Mode allows you to show and hide the tool window or detach it from the sidebar completely, which can be very helpful when using multiple monitors. Move to lets you place the window in a different corner of the screen, and Resize allows you to change its size, as the name suggests.
Main tools
As previously mentioned, there are many different tools in Android Studio. So, to keep things focused, this topic doesn't cover those that are used less frequently.
The main tools are Build, Run, Debug, Gradle, Build Variants, and Logcat. You can read descriptions of each of them below:
Build — displays the build status of your project before it's run on a device. If an error occurs during compilation, the tool will show you the specific line where it was found.
Run — shows the state of your application at any given time. For example, if a crash occurs during testing, the tool will immediately display the name of the associated error and the location where it appears.
Debug — used to find and fix errors in code using breakpoints. A breakpoint is a point in the program where the code will stop execution.
Gradle — utilized to gather your resources, invoke the compiler, preprocess application bytecode, and build the final output file in APK or AAB format. This tool is used for all the main Gradle tasks: build, clean, installDebug, installRelease, and others. Every task can be found in the app folder, grouped into subfolders for convenience.
Build Variants — used to create different build variants. One example of using different build variants is having versions for release and debug.
Logcat — displays system message logs, along with logs of any custom messages you've added to your application.
There are several different methods that you can use to categorize your messages when developing an application: Log.v (verbose), Log.d (debug), Log.i (information), Log.w (warning), and Log.e (error).
The Logcat tool gives you the ability to filter your application's logs by choosing a specific category.
For example, when you select the Warn option in the console, only "W" logs are displayed, as shown in the below screenshot.
As you can see, there is also an Assert category. However, this is rarely used.
Conclusion
Android Studio provides a range of useful tools. In this topic, you learned about the main ones and found out how to access them. Don't forget that you can customize Android Studio's appearance. Placing elements in more convenient locations can save time by ensuring the tools and information you need are readily available.