To see how your app looks and behaves on a device, you need to build and run it. Android Studio sets up new projects so that you can deploy your app to a virtual or a physical device with just a few clicks.
This overview focuses on how to use Android Studio to build and run your app for testing and debugging. For information on how to use Android Studio to build your app so that it can be released to users, see Build your app for release to users. For more detailed information about managing and customizing your build with or without Android Studio, see Configure your build.
Basic build and run
To build and run your app, follow these steps:
- In the toolbar, select your app from the run configurations menu.
In the target device menu, select the device that you want to run your app on.

If you don't have any devices configured, you need to either create an Android Virtual Device to use the Android Emulator or connect a physical device.
Click Run
.
Android Studio warns you if you attempt to launch your project to a device that has an error or a warning associated with it. Iconography and stylistic changes differentiate between errors (device selections that result in a broken configuration) and warnings (device selections that might result in unexpected behavior but are still runnable).
Monitor the build process
To view details about the build process, select View > Tool
Windows > Build or click Build
in the tool window bar. The Build tool window
displays the
tasks that Gradle executes to build your app, as shown in figure 1.
- Sync tab: Displays tasks that Gradle executes to sync with your project files. Similar to the Build Output tab, if you encounter a sync error, select elements in the tree to get more information about the error. Also displays a summary of download impact to determine whether dependency downloads are negatively affecting your build.
- Build Output tab: Displays the tasks that Gradle executes as a tree,
where each node represents either a build phase or a group
of task dependencies. If you receive build-time or compile-time errors,
inspect the tree and select an element to read the error output, as shown in
figure 2.
Figure 2. Inspect the Build Output tab for error messages. - Build Analyzer tab: Provides build performance analysis information about your build. See Troubleshoot build performance with Build Analyzer for more information.
- Restart: Performs the last build action again. If you last ran Build > Make Selected Module, it'll build the current module. If you last ran Build > Make Project, it'll generate intermediate build files for all modules in your project.
- Filters: Filters out warnings, tasks, or both that completed successfully. This can make it easier to find issues in the output.
If your build variants use product flavors, Gradle also invokes tasks to
build those product flavors. To view the list of all available build tasks,
click View > Tool Windows > Gradle or click Gradle
in the tool window bar.
If an error occurs during the build process, Gradle may recommend
command-line options to help you resolve the issue, such as
--stacktrace or --debug. To use command-line options
with your build process:
- Open the Settings or Preferences
dialog:
- On Windows or Linux, select File > Settings from the menu bar.
- On macOS, select Android Studio > Preferences from the menu bar.
- Navigate to Build, Execution, Deployment > Compiler.
- In the text field next to Command-line Options, enter your command-line options.
- Click OK to save and exit.
Gradle applies these command-line options the next time you try building your app.
Build and run using the AI agent
The AI agent in Android Studio has access to tools that let it build and deploy your app, and then verify the app's state on your behalf. When you use Agent Mode, the agent can perform tasks such as:
- Deploy your app to a connected physical device or emulator.
- Inspect the screen and take screenshots to verify UI changes.
- Check Logcat for runtime errors or specific log messages.
- Interact with your app using
adb shellcommands to navigate or enter data.
Using the AI agent to build and run your app is useful for multi-stage tasks where the agent needs to iteratively make changes and verify that they work as expected.
Advanced build and run features
The default way to build and run your app in Android Studio should be sufficient to test a simple app. However, you can use these build and run features for more advanced use cases: