New features in Android Studio Preview

Android Studio Arctic Fox | 2020.3.1 has been released to the stable channel. Download it here.

Android Studio Bumblebee | 2021.1.1 is currently in the Canary and Dev channels.

Android Gradle plugin (AGP) 7.0 has been released to the stable channel. For more information, see the AGP release notes.

For the latest news on releases, including a list of notable fixes in each release, also see the Release updates.

If you encounter any problems using a preview version of Android Studio, please let us know. Your bug reports help to make Android Studio better.

Android Studio Bumblebee | 2021.1.1

New Device Manager

New Device Manager window with "pair device" menu option highlighted

The Device Manager is a stand-in replacement for the AVD Manager, both from Android Studio’s Welcome Screen or after you open a project. The Device Manager introduces some new capabilities that make this feature more easy to create and manage all of your local test devices, such as:

  • A more flexible UI that supports being docked in the IDE, floating, or in a separate window, like you can with other Android Studio tool windows. This gives you easier access to your devices without obstructing other windows of the IDE.
  • A Virtual tab that allows you to create, manage, and deploy virtual devices; see details of each device at a glance; or quickly inspect the device in the Device File Explorer with a single click.
  • A Physical tab that allows you to quickly pair to a new device using ADB Wifi and see details of each physical device at a glance. You can also quickly inspect each device’s file system using the Device File Explorer with a click of a button.

To open the new Device Manager, do one of the following:

  • From the Android Studio Welcome screen, select More Actions > Virtual Device Manager.
  • After opening a project, select View > Tool Windows > Device Manager from the main menu bar.

New in Layout Inspector

Capture layout hierarchy snapshots

Layout Inspector now allows you to save snapshots of your running app’s layout hierarchy, so that you can easily share them with others or refer to them later.

Snapshots capture the data you would typically see when using the Layout Inspector, including a detailed 3D rendering of your layout, the component tree of your View, Compose, or hybrid layout, and detailed attributes for each component of your UI. To save a snapshot, do the following:

  1. Deploy your app to a device running API level 23 or higher
  2. Open the Layout Inspector by selecting View > Tool Windows > Layout Inspector.
  3. The Layout Inspector should connect to your app process automatically. If not, select the app process from the dropdown menu.
  4. When you want to capture a snapshot, click Export snapshot Export
icon from the Layout Inspector toolbar.
  5. In the system dialog that appears, specify the name and location you want to save your snapshot. Make sure to save the file with a *.li extension.

You can then load a Layout Inspector snapshot by selecting File > Open from the main menu bar, and opening a *.li file.

Layout inspector snapshot for the Sunflower sample app

Support for inspecting Compose semantics

In Compose, Semantics describe your UI in an alternative manner that is understandable for Accessibility services and for the Testing framework. In Android Studio Bumblebee, you can now use the Layout Inspector to inspect semantic information in your Compose layouts.

Semantic information displayed via the Layout Inspector

When selecting a Compose node, use the Attributes window to check whether it declares semantic information directly, merges semantics from its children, or both. To quickly identify which nodes include semantics, either declared or merged, use select the View options dropdown in the Component Tree window and select Highlight Semantics Layers. This highlights only the nodes in the tree that include semantics, and you can use your keyboard to quickly navigate between them.

Avoid Activity restarts

Connecting the Layout Inspector to a running app on older versions of Android Studio would cause your app’s Activity to restart. This is required to set a device flag that enables inspection of your app’s layouts.

In Android Studio Bumblebee, you can avoid Activity restarts when connecting the Layout Inspector by setting this flag ahead of time using one of the following steps:

  • Enable a Run Configuration option

    1. Select Run > Edit Configurations from the main menu bar. The Run/Debug Configurations dialog appears.
    2. Navigate to the run configuration you would like to use.
    3. In the Layout Inspector options section, check the box next to Connect to Layout Inspector without restarting activity.
    4. Use the run configuration the next time you want to inspect your app using the Layout Inspector.
  • Set the flag from the command line:

    1. Open a terminal window on the machine that’s connected to your device
    2. Set the device flag for your app using the following command:
    adb shell settings put global debug_view_attributes_application_package <my_package_name>
    1. Deploy your app to the device and connect the Layout Inspector. Android Studio will check whether the flag is set and avoid restarting the Activity if possible.

New in App Inspection

In Android Studio Bumblebee, there are new tools and functionalities in the App Inspection window. You can open the App Inspector by selecting View > Tool Windows > App Inspection from the main menu bar.

Network Inspector

The Network Profiler in the Profilers tool window has now moved to the App Inspection tool window. If you’ve previously used the Network Profiler, all the same features and rich network traffic data is still available. Simply deploy your app to a device running API level 26 and higher and open the App Inspector > Network Inspector tab.

Inspect Jobs, Alarms, and Wakelocks

The Background Task Inspector now allows you to inspect your app’s Jobs, Alarms, and Wakelocks, in addition to the existing support for inspecting Workers. Each type of asynchronous task now appears under the appropriate heading in the inspector tab, allowing you to easily monitor its status and progress. Similar to Workers, you can select a Job, Alarm, or Wakelock to inspect its detailed information in the Task Details panel.

Background Task Inspector

Because Workers use Jobs and Wakelocks under the hood, those tasks that are scheduled by Workers appear as children of each Worker. Keep in mind, you can only see Workers in the Graph mode.

Android Testing

Android Studio Bumblebee Canary 8 and AGP 7.1.0 alpha-08 introduce several new features and improvements to help you more reliably and scalably run your automated instrumentation tests and see useful results you can use to debug issues. These are features in addition to those launched in Android Studio Arctic Fox, such as parallel device testing and Gradle test runner for unit tests.

Unified Gradle test runner

When running instrumented tests, previous versions of Android Studio used the IntelliJ Android instrumented test runner. Meanwhile, the Android Gradle plugin uses Gradle’s own implementation of the Android instrumented test runner. So, depending on whether you run your tests from Android Studio or from the command line using the Gradle plugin, such as on your continuous integration server, you might see different test results, such as tests passing using one runner and failing on another.

Discrete test runners in older versions of Android Studio

To resolve this issue, Android Studio Bumblebee now also uses Gradle’s Android instrumented test runner when running your tests. Now, when running your automated instrumentation tests from Android Studio, your results are more likely to be consistent with those you run using the Android Gradle plugin from the command line.

Unified Gradle test runner in Bumblebee

If you already have instrumented test configurations saved to your project, they’ll now use Gradle to run tests on your connected device. Otherwise, you can create a new instrumented test configuration using the gutter action next to your test class or method, as shown below.

Run tests from gutter action

When running your instrumented tests, you can confirm that Android Studio is using the Gradle test runner by inspecting the test output in the Test Matrix for Gradle task output. Although we are improving this feature with each release of Android Studio, there are some known issues. If you are experiencing issues, please report a bug. You can also disable the new testing pipeline to revert to the old behavior.

Gradle Managed Virtual Devices

In order to improve consistency, performance, and reliability when using Android Virtual Devices for your automated instrumented tests, we’re introducing Gradle Managed Virtual Devices. This feature allows you to configure virtual test devices in your project's Gradle files that the build system uses to fully manage—that is, create, deploy, and tear down—those devices to execute your automated tests.

Because this feature grants Gradle visibility into not only the tests you’re running, but also the devices’ lifecycle, it’s able to improve the quality of your testing experience in the following ways:

  • Handles device-related issues in order to ensure your tests are executed
  • Utilizes emulator snapshots to improve device startup time and memory usage, and restore devices to a clean state between tests
  • Caches test results and reruns only tests that are likely to provide different results
  • Provides a consistent environment for running your tests between local and remote test runs
Get started

You can specify a virtual device that you want Gradle to use for testing your app in your module-level build.gradle file. The following code sample creates a Pixel 2 running API level 29 as a Gradle managed device.

android {
  testOptions {
    devices {
      pixel2api29 ( {
        // Use device profiles you typically see in Android Studio
        device = "Pixel 2"
        apiLevel = 29
        // You can also specify "aosp" if you don’t require Google Play Services.
        systemImageSource = "google"
        abi = "x86"

To run your tests using the Gradle managed devices you configured, use the following command. device-name is the name of the device you configured in your Gradle build script (such as pixel2api29), and BuildVariant is the build variant of your app you want to test.

Define groups of devices

To help you scale your tests across multiple device configurations, such as different API levels and form factors, you can define multiple Gradle managed devices and add them to a named group. Gradle can then execute your tests across all the devices in the group in parallel.

The example below shows two managed devices added to a device group called phoneAndTablet.

testOptions {
    devices {
      pixel2api29 ( { ... }
      nexus9api30 ( { ... }
    deviceGroups {
      phoneAndTablet {
        targetDevices.addAll(devices.pixel2api29, devices.nexus9api30)

To run your tests using the group of Gradle managed devices, use the following command.

Android Emulator now runs directly inside Android Studio by default

Launching the emulator inside Studio conserves screen real estate, and gives you the ability to write and test your apps inside one window without leaving Android Studio.

When the emulator is running, you'll have access to common emulator actions like rotating, and extended control options like navigation playback. To run the emulator in a separate window instead go to File > Settings > Tools > Emulator and deselect Launch in a tool window.

Compatibility with Emulator Snapshots for test failures

Test runs using Gradle managed devices are compatible with Emulator snapshots for test failures. That is, when you enable snapshots for test failures when running tests with managed devices, Gradle will also generate a snapshot for each test assertion failure, so that you can use them to debug the issue later. To use managed virtual devices with Emulator snapshots for test failures enabled, simply include the command-line flag to enable snapshots.

$ gradlew

Keep in mind, to use the snapshots, you’ll need to import the test results into Android Studio.

Emulator Snapshots for test failures

When you inspect failed assertions after running instrumented tests, it's sometimes difficult or time consuming to reproduce that test failure again. However, reproducing those failures on your connected device is critical in helping you diagnose the issue, either by attaching a debugger or interacting with the app at the time of failure.

When using Android Studio Bumblebee with In Android Gradle plugin 7.0-alpha13 and higher, you can use Emulator Snapshots for test failures – a quicker way to reproduce test failures when using the Android Emulator. In other words, when your instrumented tests running on a connected Emulator encounter a Java or Kotlin assertion that fails, the device takes a snapshot at the time of failure. After your test run completes, you can then reload the snapshot on the same device in order to reproduce and investigate that failure.

To get started, first update the Android Emulator to 30.4.3 or higher, then follow these steps:

  1. Select Run > Edit Configurations … from the menu bar.
  2. If you don’t already have an instrumented test configuration, create an instrumented test configuration you want to run.
  3. Open the instrumented test configuration and select Yes from the dropdown next to Enable Emulator Snapshots for test failures.
  4. By default, Android Studio generates up to two snapshots per device, per test run. To change this maximum number of snapshots, enter the desired amount next to Max Snapshots per test run.
  5. If you want to compress snapshots, check the box next to Compress snapshots.
  6. Click OK.
  7. Deploy your tests to a virtual device as you normally would.

Enable Emulator Snapshots for test failures

The Run window should appear and show you the results of your test run. To load a snapshot, select a failed test that indicates Test results in the column under the device name. In the right side of the tool window, select the Retention tab. After Android Studio validates the snapshot for that test failure, click the Start retention debug button to load the snapshot to a device. You can then attach a debugger to investigate the cause of the issue.

Automated Test Snapshots window

Enable snapshots for command-line tests

You can enable emulator snapshots for tests you run from the command line in one of two ways: by enabling it in your app module’s build.gradle file or by passing parameters to the Gradle connectedCheck task. To enable the feature in your Gradle buildscript, include the following in your app module’s build.gradle file.

android {
    testOptions {
      emulatorSnapshots {
        // Enables the feature
        enableForTestFailures true
        // The number of snapshots to take during a test run. When not
        // specified, the default value is 2. After reaching the max number
        // of snapshots, subsequent assertion failures in a test run do not
        // generate additional snapshots. Keep in mind, snapshots can consume
        // a significant amount of disk space.
        maxSnapshotsForTestFailures 2

Next, start the Android Virtual Device you'd like to use and run your app's instrumented tests from the command line, as follows:

Linux and Mac

./gradlew connectedCheck


gradlew connectedCheck

Alternatively, if you don’t want to enable the feature in your app's build.gradle file, you can simply pass the following properties in the command line:

Import test failures into Android Studio

If you’re running your tests from outside of Android Studio, you need to import your test results into the IDE in order to use any of the generated snapshots.After the tests complete, you should see test results in the <project>/<module>/build/outputs/ androidTest-results/connected/ folder. If your test run encountered an assertion failure, you should see a tar snapshot file for each snapshot that was taken. To see the results in Android Studio and load the snapshots to your running virtual device, select Run > Import Tests from File from the menu bar, navigate to the test-result.pb file from the test results directory, and click Open.

The Run window should appear and show you the results of your test run.

Compress snapshots

Snapshots provide high fidelity in reproducing your test failures, but they each consume a large amount of disk space. If you want to instead generate compressed snapshots, add the following to your build.gradle file. Keep in mind, compressing snapshots increases the time it takes to complete the process and continue with the test execution.

android {
    testOptions {
      failureRetention {
        // Generates snapshots that are compressed into a single TAR file.
        compressSnapshots true

Alternatively, you can pass the following property from the command line.



Disable the new testing pipeline

By default Android Studio Bumblebee uses Gradle to run its instrumentation tests. If you're experiencing issues, you can disable this behavior as follows:

  1. Select File > Settings > Build, Execution, Deployment > Testing (or Android Studio > Preferences > Build, Execution, Deployment > Testing on MacOS.)
  2. Uncheck the box next to Run Android instrumented tests using Gradle and click OK.

If you're using AGP 7.1.0-alpha08 and higher, you can also revert to older behaviors by doing one of the following:

  • When running Gradle tasks from the command line, use the following command line parameter: -Pandroid.experimental.androidTest.useUnifiedTestPlatform=false
  • Add the following parameter to your project's file: android.experimental.androidTest.useUnifiedTestPlatform=false

To help resolve issues that you might be expereincing, please report a bug.

Improved resource shrinker

Android Studio Bumblebee includes an improved resource shrinker that helps reduce your app size.

Support for apps with dynamic features

The default implementation of the Android resource shrinker has been updated in Android Gradle Plugin 7.1.0-alpha09. The new implementation supports shrinking apps with dynamic features.

Experimental further app size reductions

The new resource shrinker implementation can reduce the size of your shrunk app even more by modifying the resource table to remove unused value resources and references to unused file resources. The new resource shinker can delete unused file resources completely, reducing the size of your app more. This behavior is not enabled by default yet, but you can opt in to try it by adding the experimental option android.experimental.enableNewResourceShrinker.preciseShrinking=true to your project's file.

Please report any issues you find with the new resource shrinker or the experimental flag. To help diagnose issues, or as a temporary workaround, you can switch back to the previous implementation by adding android.enableNewResourceShrinker=false to your project's The new shrinker replaces unused file-based resources with slightly different minimal files than the previous resource shrinker, but this is not expected to have any runtime impact.

The old implementation is scheduled to be removed in Android Gradle plugin 8.0.0.

Publish Javadoc JAR

Android Gradle plugin 7.1.0 and higher allows you to generate Javadoc from Java and Kotlin sources and publish Javadoc JAR files in addition to AARs for library projects. The Javadoc will be added to the POM and Gradle Module Metadata files. Enable this feature by adding withJavadocJar() under the singleVariant or multipleVariants publishing block. To learn more, see the publishing options code sample.