Skip to content

Most visited

Recently visited

navigation

Create and Edit Run/Debug Configurations

When you run, debug, or test your code, Android Studio uses a run/debug configuration to determine how to perform the operation. Typically, the default configuration is sufficient and you can simply run or debug your app. However, you can modify and create new configurations, and modify the default templates, to suit your development process.

About Run/Debug Configurations

Run/debug configurations specify details such as app installation, launch, and test options. You can define a configuration for one-time use, or save it for future use. After you save it, you can select the configuration from the Select Run/Debug Configuration drop-down list within the toolbar. Android Studio saves configurations as part of the project.

Default run/debug configuration

When you first create a project, Android Studio creates a default run/debug configuration for the main activity based on the Android App template. To run or debug your project, you must always have at least one run/debug configuration defined. For this reason, we recommend that you don’t delete this configuration.

Project scope and version control

Run/debug configurations and template changes apply to the current project only. If you choose to share a run/debug configuration and then check your project into a version control system, the configuration is shared with anyone who checks out the project. You can’t share templates.

Opening the Run/Debug Configurations Dialog

The Run/Debug Configurations dialog displays your run/debug configurations and the available default templates. In this dialog, you can:

To open the dialog, do one of the following:

The Run/Debug Configurations dialog appears, as shown in Figure 1.

Figure 1. The Run/Debug Configurations dialog.

In the left panel, the dialog displays default templates in the Defaults folder. It groups your defined configurations by template type. You can resize the dialog to see any items that are hidden.

Creating a New Run/Debug Configuration

You can define new run/debug configurations from the Run/Debug Configurations dialog, the Project window, or the Code Editor. The new configuration must be based on a default template.

In the Run/Debug Configurations dialog, you can start a new configuration directly from a template, or from a copy of another configuration. You can then change the field values as needed.

Alternatively, you can right-click an item in the Project window to automatically create a configuration specific to that item. For example, if you want to run a particular activity, you can right-click the activity Java file and select Run. Depending on the item, Android Studio uses an Android App, Android Tests, or JUnit default template to create the configuration.

In the Code Editor, you can easily create a test and run/debug configuration for a class or method, and then execute it.

When you create a configuration outside of the Run/Debug Configurations dialog, the configuration is temporary unless you save it. By default, you can have up to five temporary configurations in the project before Android Studio starts to remove them. To change this default, in the Run/Debug Configurations dialog, click the Defaults folder and type a value in the Temporary Configurations Limit field. For more information on temporary configurations, see Creating and Saving Temporary Run/Debug Configurations.

You can share a run/debug configuration (but not a template) through your version control system. If you select Shared in your run/debug configuration and then check your project into a version control system, anyone who checks out the project receives the configuration.

Starting a configuration based on a template

To define a run/debug configuration based on a template, follow these steps:

  1. Open the Run/Debug Configurations dialog.
  2. Click Add New Configuration .
  3. Select a default template.
  4. Type a name in the Name field.
  5. Modify the configuration, as needed.
  6. Be sure to correct any errors displayed at the bottom of the dialog.

  7. Click Apply or OK.

Starting a configuration from a copy

To define a run/debug configuration starting from a copy of another configuration, follow these steps:

  1. Open the Run/Debug Configurations dialog.
  2. Select an existing run/debug configuration in the left pane.
  3. Click Copy Configuration .
  4. Type a name in the Name field.
  5. Modify the configuration, as needed.
  6. Be sure to correct any errors displayed at the bottom of the dialog.

  7. Click Apply or OK.

Defining a configuration for an item in the project

Android Studio can automatically create a run/debug configuration for some items displayed in the Project window. The configuration is based on a default template:

Note: For a build.gradle or settings.gradle file, Android Studio uses the Groovy template. Instead, you should use the Gradle Console to run or debug a build.gradle file.

To create a run/debug configuration for an item in your project, follow these steps:

  1. Open a project in Android or Project view.
  2. In the Project window, right-click an item and choose Run or Debug.
  3. Android Studio creates a temporary run/debug configuration and launches your app.

  4. To save the configuration, select Save from the Select Run/Debug Configuration drop-down list in the toolbar.
  5. The drop-down list is to the left of Run and Debug ; for example, .

    Alternatively, right-click the item again and select Save.

    Or, select the configuration in the Run/Debug Configurations dialog and click Save Configuration on the upper left.

    Except for an activity, if you right-click and then run or debug the same item again, Android Studio creates a new configuration.

Defining a test configuration for a class or method

Android Studio lets you define a test run configuration for a class or method, and then execute it. For example, if you create a new class, you can create and run a test for it. If the test passes, you can then run the tests for the rest of the project to make sure that your new code doesn’t break anything somewhere else.

Android Studio uses the Android Tests or JUnit template, depending on your source set. For a local unit test, you can optionally run with code coverage.

To create a run/debug configuration for a class or method in your Java code, follow these steps:

  1. Open a project in Android or Project view.
  2. Open a Java file in the Code Editor.
  3. Select a class or method in the code, and then press Ctrl+Shift+T (⌘⇧T).
  4. Select Create New Test from the menu that appears.
  5. In the Create Test dialog, optionally change the field values, and then click OK.
  6. In the Choose Destination Directory dialog, select androidTest to create an instrumented test or test to create a local unit test. Click OK.
  7. The new test appears in the Project window in the corresponding test source set.

  8. To run the test, do one of the following:
    • In the Project window, right-click the test and select Run or Debug.
    • In the Code Editor, right-click a class definition in the test file and select Run or Debug to test all methods in the class.
    • In the Code Editor, right-click a method name in the test file and select Run or Debug to test just that method.
    • In the Code Editor, click Play in the left margin next to a class or method and select Run or Debug.
  9. To save the configuration, select Save from the Select Run/Debug Configuration drop-down list within the toolbar.
  10. The drop-down list is to the left of Run and Debug ; for example, .

    Alternatively, right-click the item again and select Save.

    Or, select the configuration in the Run/Debug Configurations dialog and click Save Configuration on the upper left.

Running or Debugging an App Using a Saved Configuration

If you’ve saved a run/debug configuration, you can select it before you run or debug your app.

To use a saved run/debug configuration, follow these steps:

  1. Select the run/debug configuration from the Select Run/Debug Configuration drop-down list within the toolbar.
  2. The drop-down list is to the left of Run and Debug ; for example, .

  3. Select Run > Run or Run > Debug.
  4. Alternatively, click Run or Debug .

Note: During an Instant Run session, selecting a different run/debug configuration, and then clicking Run or Debug again, ends the current session.

Editing a Run/Debug Configuration

To edit a run/debug configuration, follow these steps:

  1. Open the Run/Debug Configurations dialog.
  2. Select a configuration in the left pane.
  3. Modify the configuration, as needed.
  4. Be sure to correct any errors displayed at the bottom of the dialog.

  5. Click Apply or OK.

Editing a Default Run/Debug Configuration Template

You can edit the default templates provided by Android Studio to suit your development process. When you edit a template, it doesn’t affect existing configurations that use the template. So, for example, if you need to create a number of configurations of a certain type, you can edit the template and then change it back when you’re done.

Although you can’t create new templates, you can create configurations to use similar to a template. You can copy a configuration and edit the copy to create new configurations.

To edit a template, follow these steps:

  1. Open the Run/Debug Configurations dialog.
  2. Expand the Defaults folder and select a default template.
  3. Modify the configuration, as needed.
  4. Be sure to correct any errors displayed at the bottom of the dialog.

  5. Click Apply or OK.

Sorting and Grouping Configurations

In the Run/Debug Configurations dialog, you can order your configurations to be able to find them quickly. You can sort the items in the folder alphabetically, and create new folders to group configurations.

To sort configurations alphabetically, follow these steps:

  1. Open the Run/Debug Configurations dialog.
  2. Select a folder containing configurations.
  3. Click Sort Configurations .
  4. Click Apply or OK.

To group configurations in folders, follow these steps:

  1. Open the Run/Debug Configurations dialog.
  2. Select a folder containing configurations.
  3. Click Create New Folder .
  4. Type a name in the Name field.
  5. Drag items in the same template category into the folder.
  6. Order the folders and configurations in the same template category by dragging them into position or using Move Up and Move Down .
  7. Click Apply or OK.

Defining Before Launch Operations

You can specify tasks to execute before applying the run/debug configuration. The tasks are performed in the order they appear in the list. Defining before launch tasks is an advanced feature.

Instead of using this feature, we recommend that you put any preparation logic as tasks in your build.gradle file so they’ll be executed when building from the command line.

To create a task list, follow these steps:

  1. To add a task to the list, click Add and select a task type. If a dialog opens, fill in the fields and click OK.
  2. Add more tasks as needed.
  3. To order the tasks, select a task and click Up and Down to move it up or down in the list.
  4. Select Show this page if you want to display the run/debug configuration settings before applying them.

    This option is deselected by default.

  5. Select Active tool window if you want the Run or Debug tool window to be activated automatically when you run or debug your app.
  6. This option is selected by default.

To remove a task from the list, follow these steps:

  1. Select a task.
  2. Click Remove .

To edit a task, follow these steps:

  1. Select a task.
  2. Click Edit .
  3. Edit the task settings in the dialog that opens, and then click OK.

The following table lists the available tasks you can add.

Task Description
Run External tool Run an application that’s external to Android Studio. In the External Tools dialog, select one or more applications that you want to run and then click OK. If the application isn’t defined in Android Studio yet, add its definition in the Create Tools dialog. For more information, see Configuring Third-Party Tools and External Tools.
Run Another Configuration Execute one of the existing run/debug configurations. In the Choose Configuration to Execute dialog, select a configuration to execute and then click OK.
Make Compile the project or the module. Android Studio executes the Make Module command if the run/debug configuration specifies a particular module, or it executes the Make Project command if no modules are specified.
Make Project Compile the project. Android Studio executes the Make Project command.
Make, no error check This option is the same as Make, except that Android Studio executes the run/debug configuration irrespective of the compilation result.
Build Artifacts Unsupported in Android Studio.
Run Gradle task Run a Gradle task. In the dialog that opens, specify the details and then click OK. For more information, see Gradle.
Gradle-aware Make Compile the project and run Gradle.
App Engine Gradle builder The App Engine Gradle builder task syncs the project and then does a build of the module.

Default Run/Debug Configuration Templates

Android Studio provides default configuration templates to help you get started quickly. The following templates are applicable to Android development with Android Studio:

Note: Android Studio 2.1.x and lower had a Native Application template, which newer versions don't have. If you have a Native Application template in a project, Android Studio automatically converts it to Android App when you load the project. A Convert Project dialog guides you through the process.

The following unsupported templates come from IntelliJ IDEA and aren’t specific to Android development with Android Studio:

Follow the links to the IntelliJ IDEA documentation for details on using these templates.

Android App

You can run or debug Android apps and activities on virtual or hardware devices by using configurations based on this template.

Name and share

A run/debug configuration has the Name and Share options, while the template doesn’t.

Field Description
Name The name of the run/debug configuration.
Share

Select this option to make the run/debug configuration available to other team members through version control. You can share a run/debug configuration, but not a template. If you select this option, when the project is checked into Git (or another version control system), the run/debug configuration is included when someone checks out the project.

Android Studio stores the shared run/debug configuration in an individual XML file in the .idea/runConfigurations folder; otherwise, it stores the configuration in the .idea/workspace.xml file. For more information, see Directory-based Project Format.

Default: deselected

General tab

In the General tab, you can specify installation, launch, and deployment options. The Miscellaneous tab also contains installation options.

Field Description
Module Select a module to apply this configuration to.
Installation Options: Deploy

Select an option:

  • Default APK (default) - Create an APK as specified in your build configuration.
  • Custom Artifact - Unsupported in Android Studio.
  • Nothing - Don’t install an APK on a device. For example, if you prefer to manually install the APK, you don’t need Android Studio to install it.
Installation Options: Install Flags Type any adb pm install options you want to use. Format the options as you would on the command line, but without a path. Here are some examples:

-i foo.bar.baz -r /path/to/apk

and

-d -r

Default: no options

Launch Options: Launch

Select an option:

  • Nothing - Don’t launch anything. If you’ve specified Nothing in the Deploy field, your app is already running, and you select Debug, this option is similar to using Attach debugger to Android process; selecting Run does nothing.
  • Default Activity (default) - Launch the activity you’ve marked as startup in the manifest. For example:
  • <intent-filter>
      <action android:name="android.intent.action.MAIN" />
      <category android:name="android.intent.category.LAUNCHER" />
    </intent-filter>
    
  • Specified Activity - Launch a particular app activity in your module. Type the name, or click to select an activity from a list.
  • URL - Specify a URL to launch. See Testing a URL.
Launch Options: Launch Flags Type any adb am start options you want to use. Format the options as you would on the command line, but without an intent. For example:

-W

This option doesn’t appear if you chose a Launch value of Nothing.

Default: no options

Deployment Target Options: Target

Select an option:

  • Open Select Deployment Target Dialog (default) - Open the Select Deployment Target dialog to select a virtual or hardware device.
  • USB Device - Use a hardware device connected to your development computer through a USB port. If there’s more than one, a dialog appears so you can select it.
  • Emulator - Use a virtual device. In a configuration, you can select an AVD; otherwise, it just uses the first AVD in the list.

Deployment Target Options: Use same device for future launches

If you want to automatically use the device you chose through the Select Deployment Target dialog in the future, select this option. If the device isn’t available, you’ll receive a dialog. Default: deselected
Before Launch See Defining Before Launch Operations.

Miscellaneous tab

In the Miscellaneous tab, you can specify logcat, installation, launch, and deployment options. The General tab also contains installation options.

Field Description
Logcat: Show logcat automatically When this option is selected, the logcat tab of Android Monitor activates automatically every time you successfully deploy and launch an app using this configuration. Otherwise, the focus doesn’t move to the logcat tab automatically on app start. Default: selected
Logcat: Clear log before launch Select this option if you want Android Studio to remove data from previous sessions from the log file before starting the app. Default: deselected
Installation Options: Skip installation if APK has not changed When selected, Android Studio doesn’t redeploy your APK if it detects that it’s unchanged. If you want Android Studio to force an install of the APK, even if it hasn’t changed, then deselect this option. Default: selected
Installation Options: Force stop running application before launching activity

If selected, when Android Studio detects that it doesn't have to reinstall an APK because it hasn’t changed, it will force-stop the app so that the app starts from the default launcher activity. If this option is deselected, Android Studio doesn’t force-stop the app.

This option works in conjunction with the previous option that controls whether an APK is installed or not. For both Installation Options fields, leave them at the default unless you explicitly want to force an install every time.

In some cases you might want to deselect this option. For example, if you’re writing an input method engine (IME), force-stopping the app deselects it as the current keyboard, which you might not want.

Default: selected

Before Launch See Defining Before Launch Operations.

Debugger tab

Specify debug options in the Debugger tab.

For C and C++ code, Android Studio uses the LLDB debugger. In addition to the normal Android Studio UI, the debugger window has an LLDB tab that lets you enter LLDB commands during debugging. You can enter the same commands that Android Studio uses to display information in the debugger UI, and you can perform additional operations.

For C and C++ projects, you can add symbol directories, as well as LLDB startup and post attach commands, in the Debugger tab. To do so, you use buttons similar to the following:

See Debug Your App for more information about debugging in Android Studio.

Field Description
Debug type

Select one of the following options:

  • Auto (default) - Let Android Studio choose the best debug type for your project.
  • Java - Debug Java code only.
  • Native - Debug native C or C++ code.
  • Hybrid - Debug Java and native code in two separate debug sessions.

The Auto option is recommended because it automatically chooses the right debug type for your project.

Experimental: Use Java aware C++ debugger - Android N+ only

Select this option to debug both C++ and Java Android code within the same LLDB debug session. The Java-aware C++ debugger is an extension of the Native debugger mode; along with C++ debugging, it supports Java as well.

To be able to use this feature, the project must

  • use Android 7.0 (API level 24) or higher only
  • have a Debug type of Native or Auto

If you selected a Debug type of Auto, Android Studio automatically selects this option if the project meets the requirements. Note that if you have a Java-only project and want to use LLDB to debug it, you can select this option and Native.

As of Android Studio 2.2, this feature is experimental. For more information, see Use the Experimental Java-aware C++ Debugger.

Default: deselected

Symbol Directories

If you want to add symbol files to provide the debugger with C or C++ information generated outside of Android Studio, you can add one or more directories here. Android Studio preferentially uses any files within these directories over files generated by the Android Plugin for Gradle. The debugger searches the directories from top to bottom, in order, until it finds what it needs. It searches recursively through the files in the directory. To optimize the list and save time, put the directories used most often toward the top of the list.

If you specify a directory high in the tree, it can take longer to search all of the subdirectories. If you add a very specific directory, it takes less time to search. You need to find the right balance between speed and finding the files you need for debugging. For example, if you have a directory that contains subdirectories for different Android Binary Interfaces (ABIs), you can choose to add a directory for a specific ABI or for all ABIs. Although it can take longer to search through the upper-level directory, it’s also more foolproof should you decide to debug on a different device.

Note that you don’t have to add directories containing Gradle symbol files because the debugger uses them automatically.

LLDB Startup Commands

Add LLDB commands that you want to execute before the debugger attaches to the process. For example, you can define settings for the environment, as shown in the following command:

settings set target.max-memory-read-size 2048

LLDB executes the commands in order from top to bottom.

LLDB Post Attach Commands

Add LLDB commands that you want to execute right after the debugger attaches to the process. For example:

process handle SIGPIPE -n true -p true -s false

LLDB executes the commands in order from top to bottom.

Host working directory Specify the LLDB working directory.
Logging: Target channels

Specify LLDB log options. Android Studio sets the default options based on the team’s experience — so it’s not too slow but contains needed information for troubleshooting issues. The log is often requested for Android Studio bug reports. This default is

lldb process:gdb-remote packets

You can change the default to gather more information. For example, the following log options gather information about a specific platform:

lldb process platform:gdb-remote packets

For a complete list of log commands, enter the log list command from an LLDB shell window in Android Studio.

Android Studio places device logs in the following location, where ApplicationId is the unique application ID that’s used in your built APK manifest, and identifies your app on your device and in the Google Play store:

/data/data/ApplicationId/lldb/log

Or, if multiple users access a device, it places the logs in the following location, where AndroidUserId is a unique identifier for a user on the device:

/data/user/AndroidUserId/ApplicationId/lldb/log

For information about using LLDB for remote debugging, see Remote Debugging.

Before Launch See Defining Before Launch Operations.

Profiling tab

Specify GPU Debugger profiling options for Android Monitor in the Profiling tab.

Field Description
Graphics Trace Options: Capture GPU Commands

If enabled, running this run/debug configuration will build, install, and run the app with GPU tracing. Tracing isn't supported when debugging an app. If you debug an app with GPU tracing, you'll receive a message and the debugger launches without tracing. This option is relevant for the GPU Debugger tool.

Note that after you enable this checkbox, every time you launch the app it will block and wait for you to attach either the debugger or the GPU Debugger.

Graphics Trace Options: Disable precompiled shaders and programs

Select this option to disable OpenGL ES graphics driver support for precompiled shader and program binaries during tracing. This option is relevant for the GPU Debugger tool.

Precompiled shaders aren’t supported for replaying traces, and so only shaders compiled at runtime using the glShaderSource function can be used for framebuffer inspection.

Apps should always query for precompiled shader support before using the glShaderBinary or glProgramBinary functions, and fall back to runtime compilation if precompiled shaders or programs aren’t supported.

Default: deselected

Before Launch See Defining Before Launch Operations.

Android Tests

The tests template that you should use depends on your source set. The Android Tests template is for an instrumented test. The JUnit template is for a local unit test.

If you're using Firebase Test Lab to test on a variety of devices, you can use this template to define your instrumented tests. For more information, see Run Your Tests with Firebase Test Lab.

Name and share

A run/debug configuration has the Name and Share options, while the template doesn’t.

Field Description
Name The name of the run/debug configuration.
Share

Select this option to make the run/debug configuration available to other team members through version control. You can share a run/debug configuration, but not a template. If you select this option, when the project is checked into Git (or another version control system), the run/debug configuration is included when someone checks out the project.

Android Studio stores the shared run/debug configuration in an individual XML file in the .idea/runConfigurations folder; otherwise, it stores the configuration in the .idea/workspace.xml file. For more information, see Directory-based Project Format.

Default: deselected

General tab

In the General tab, you can specify test location, instrumentation runner, adb shell, and deployment options.

Field Description
Module Select a module to apply this configuration to.
Test

In this area, specify the location of tests that you want to run:

  • All in module (default) - Launch all tests from the selected module.
  • All in package - Launch all tests from the package specified in the Package field. Type the name, or click to select the package from a dialog.
  • Class - Launch tests of the class specified in the Class field. Type the name, or click to select the class from a dialog.
  • Method - Launch a test method. In the Class field, specify the class that contains the method. In the Method field, specify the method. Type the name, or click to select the class or method from a dialog.
Specific instrumentation runner (optional) Type the location of the instrumentation runner; click to use a dialog. The build.gradle file specifies the location of the instrumentation runner; this value overrides it. The default is typically the AndroidJUnitRunner class from the Android Testing Support Library .
Extra options Type any adb am instrument options you want to use. Don’t type the component. For example, if you’re using AndroidJUnitRunner from the Android Testing Support Library, you can use this field to pass additional options to the runner, such as -e size small. Default: no options
Deployment Target Options: Target

Select an option:

  • Open Select Deployment Target Dialog (default) - Open the Select Deployment Target dialog to select a virtual or hardware device.
  • USB Device - Use a hardware device connected to your development computer through a USB port. If there’s more than one, a dialog appears so you can select it.
  • Emulator - Use a virtual device. In a configuration, you can select an AVD; otherwise, it just uses the first AVD in the list.
  • Firebase Test Lab Device Matrix - See Run Your Tests with Firebase Test Lab.
Deployment Target Options: Use same device for future launches If you want to automatically use the device you chose through the Select Deployment Target dialog in the future, select this option. If the device isn’t available, you’ll receive a dialog. Default: deselected
Before Launch See Defining Before Launch Operations.

Miscellaneous tab

The Miscellaneous tab contains logcat and installation options.

Field Description
Logcat: Clear log before launch Select this option if you want data from previous sessions to be removed from the log file before starting the app. Default: deselected
Installation Options: Skip installation if APK has not changed When selected, Android Studio doesn’t redeploy your APK if it detects that it’s unchanged. If you want Android Studio to force an install of the APK, even if it hasn’t changed, then deselect this option. Default: selected
Installation Options: Force stop running application before launching activity

If selected, when Android Studio detects that it doesn't have to reinstall an APK because it hasn’t changed, it will force-stop the app so that the app starts from the default launcher activity. If this option is deselected, Android Studio doesn’t force-stop the app.

This option works in conjunction with the previous option that controls whether an APK is installed or not. For both Installation Options fields, leave them at the default unless you explicitly want to force an install every time.

In some cases you might want to deselect this option. For example, if you’re writing an input method engine (IME), force-stopping the app deselects it as the current keyboard, which you might not want.

Default: selected

Before Launch See Defining Before Launch Operations.

Debugger tab

Specify debug options in the Debugger tab.

For C and C++ code, Android Studio uses the LLDB debugger. In addition to the normal Android Studio UI, the debugger window has an LLDB tab that lets you enter LLDB commands during debugging. You can enter the same commands that Android Studio uses to display information in the debugger UI, and you can perform additional operations.

For C and C++ projects, you can add symbol directories, as well as LLDB startup and post attach commands, in the Debugger tab. To do so, you use buttons similar to the following:

See Debug Your App for more information about debugging in Android Studio.

Field Description
Debug type

Select one of the following options:

  • Auto (default) - Let Android Studio choose the best debug type for your project.
  • Java - Debug Java code only.
  • Native - Debug native C or C++ code.
  • Hybrid - Debug Java and native code in two separate debug sessions.

The Auto option is recommended because it automatically chooses the right debug type for your project.

Experimental: Use Java aware C++ debugger - Android N+ only

Select this option to debug both C++ and Java Android code within the same LLDB debug session. The Java-aware C++ debugger is an extension of the Native debugger mode; along with C++ debugging, it supports Java as well.

To be able to use this feature, the project must

  • use Android 7.0 (API level 24) or higher only
  • have a Debug type of Native or Auto

If you selected a Debug type of Auto, Android Studio automatically selects this option if the project meets the requirements. Note that if you have a Java-only project and want to use LLDB to debug it, you can select this option and Native.

As of Android Studio 2.2, this feature is experimental. For more information, see Use the Experimental Java-aware C++ Debugger.

Default: deselected

Symbol Directories

If you want to add symbol files to provide the debugger with C or C++ information generated outside of Android Studio, you can add one or more directories here. Android Studio preferentially uses any files within these directories over files generated by the Android Plugin for Gradle. The debugger searches the directories from top to bottom, in order, until it finds what it needs. It searches recursively through the files in the directory. To optimize the list and save time, put the directories used most often toward the top of the list.

If you specify a directory high in the tree, it can take longer to search all of the subdirectories. If you add a very specific directory, it takes less time to search. You need to find the right balance between speed and finding the files you need for debugging. For example, if you have a directory that contains subdirectories for different Android Binary Interfaces (ABIs), you can choose to add a directory for a specific ABI or for all ABIs. Although it can take longer to search through the upper-level directory, it’s also more foolproof should you decide to debug on a different device.

Note that you don’t have to add directories containing Gradle symbol files because the debugger uses them automatically.

LLDB Startup Commands

Add LLDB commands that you want to execute before the debugger attaches to the process. For example, you can define settings for the environment, as shown in the following command:

settings set target.max-memory-read-size 2048

LLDB executes the commands in order from top to bottom.

LLDB Post Attach Commands

Add LLDB commands that you want to execute right after the debugger attaches to the process. For example:

process handle SIGPIPE -n true -p true -s false

LLDB executes the commands in order from top to bottom.

Host working directory Specify the LLDB working directory.
Logging: Target channels

Specify LLDB log options. Android Studio sets the default options based on the team’s experience — so it’s not too slow but contains needed information for troubleshooting issues. The log is often requested for Android Studio bug reports. This default is

lldb process:gdb-remote packets

You can change the default to gather more information. For example, the following log options gather information about a specific platform:

lldb process platform:gdb-remote packets

For a complete list of log commands, enter the log list command from an LLDB shell window in Android Studio.

Android Studio places device logs in the following location, where ApplicationId is the unique application ID that’s used in your built APK manifest, and identifies your app on your device and in the Google Play store:

/data/data/ApplicationId/lldb/log

Or, if multiple users access a device, it places the logs in the following location, where AndroidUserId is a unique identifier for a user on the device:

/data/user/AndroidUserId/ApplicationId/lldb/log

For information about using LLDB for remote debugging, see Remote Debugging.

Before Launch See Defining Before Launch Operations.

Profiling tab

Specify GPU Debugger profiling options for Android Monitor in the Profiling tab.

Field Description
Graphics Trace Options: Capture GPU Commands

If enabled, running this run/debug configuration will build, install, and run the app with GPU tracing. Tracing isn't supported when debugging an app. If you debug an app with GPU tracing, you'll receive a message and the debugger launches without tracing. This option is relevant for the GPU Debugger tool.

Note that after you enable this checkbox, every time you launch the app it will block and wait for you to attach either the debugger or the GPU Debugger.

Graphics Trace Options: Disable precompiled shaders and programs

Select this option to disable OpenGL ES graphics driver support for precompiled shader and program binaries during tracing. This option is relevant for the GPU Debugger tool.

Precompiled shaders aren’t supported for replaying traces, and so only shaders compiled at runtime using the glShaderSource function can be used for framebuffer inspection.

Apps should always query for precompiled shader support before using the glShaderBinary or glProgramBinary functions, and fall back to runtime compilation if precompiled shaders or programs aren’t supported.

Default: deselected

Before Launch See Defining Before Launch Operations.

App Engine DevAppServer

This run/debug configuration applies to the Google Cloud Platform. For more information, see Adding an App Engine Java Servlet Module and Running, Testing, and Deploying the Backend. When you follow these steps and sync your project to the build.gradle file, Android Studio creates an App Engine DevAppServer configuration for you.

Note that the IntellJ IDEA App Engine Server template is a different template that’s not available in Android Studio.

Field Description
Name The name of the run/debug configuration.
Share

Select this option to make the run/debug configuration available to other team members through version control. You can share a run/debug configuration, but not a template. If you select this option, when the project is checked into Git (or another version control system), the run/debug configuration is included when someone checks out the project.

Android Studio stores the shared run/debug configuration in an individual XML file in the .idea/runConfigurations folder; otherwise, it stores the configuration in the .idea/workspace.xml file. For more information, see Directory-based Project Format.

Default: deselected

Single instance only If you want to make sure that only one instance of the run/debug configuration is currently executed, select this option. It doesn't allow multiple runs of the same configuration at the same time. Default: selected
Module Select a module to apply this configuration to.
Synchronize with build.gradle configuration If you add an App Engine module and sync to the build.gradle file, the App Engine DevAppServer configuration fields are filled in for you (recommended). Selecting Tools > Android > Sync Project with Gradle Files also syncs the project. Default: selected
App Engine SDK Type a path to a Google App Engine SDK for Java on the local machine. Click ... to select it from a dialog.
War Path Type a path to the Web Application Archive (WAR) directory of the app you’re deploying on the local development server. Click ... to select it from a dialog.
VM Args

Specify the command-line options you want to pass to the VM for launching the DevAppServer. When specifying the options:

  • Use spaces to separate different options.
  • For options that have spaces, enclose the space in quotation marks (" ").
  • If an option includes quotation marks, add a backslash before the quotation mark (\").

For more information about VM options, see the documentation for your J2SE version, such as java JDK 7 and java JDK 8.

Default: no options

Server Address Type the host address to use for the server. You might need to provide the address to be able to access the development server from another computer on your network. An address of 0.0.0.0 allows both localhost access and hostname access. Default: localhost
Server Port Type the port number to use for the server. Default: 8080
Disable Check for App Engine SDK Updates If given, the development server will not contact App Engine to check for the availability of a new release of the SDK. By default, the server checks for a new version on startup, and prints a message if a new version is available.
Before Launch See Defining Before Launch Operations.
This site uses cookies to store your preferences for site-specific language and display options.

Hooray!

This class requires API level or higher

This doc is hidden because your selected API level for the documentation is . You can change the documentation API level with the selector above the left navigation.

For more information about specifying the API level your app requires, read Supporting Different Platform Versions.

Take a one-minute survey?
Help us improve Android tools and documentation.