The Developer Preview for Android 11 is now available; test it out and share your feedback.

New features in Android Studio Preview

Android Studio 3.6 has been released to the stable channel. Download it here.

Android Studio 4.0 is currently in the Canary and Dev channels.

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 4.0

This section provides a summary of the new features and changes in Android Studio 4.0.

CPU Profiler UI Upgrades

System Trace UI Upgrades

Based on your feedback, the CPU Profiler UI has been overhauled to provide a more intuitive workflow. Notable changes include:

  • CPU recordings are now separated from the main profiler timeline to allow for easier analysis. Recorded data are organized in groups on the left side of the Profiler window. You can move groups up and down to reorganize the list by clicking the options options icon in profiler icon in the top-right corner of the window, or by dragging-and-dropping individual items within a group.
  • For easier side-by-side analysis, you can now view all thread activity in the thread activity timeline (including methods, functions, and events).
  • The tabs for Flame Chart, Top Down, and Bottom Up analyses are now in the righthand column. In the Threads group, threads are automatically expanded for System Trace recordings and collapsed by default for other recording types. Double-click on thread names to expand or collapse them.
  • The System Trace UI, as shown in the screenshot above, is also improved. For example, events are now uniquely colored for easier differentiation.

This feature is still a work in progress, so please continue to provide feedback.

Separate annotation processing feature removed

The ability to separate annotation processing into a dedicated task has been removed. This option was used to maintain incremental Java compilation when non-incremental annotation processors are used in Java-only projects; it was enabled by setting android.enableSeparateAnnotationProcessing to true in the file, which no longer works.

Instead, you should migrate to using incremental annotation processors to improve build performance.

Build Speed window

When using Android Studio 4.0 Canary 3 with Android Gradle plugin 4.0.0-alpha03 and higher, the Build Speed window helps you understand and diagnose issues with your build process, such as disabled optimizations and improperly configured tasks. When using Android Studio 4.0 Canary 3 and higher, and Android Gradle plugin 4.0.0-alpha03 and higher, you can open the Build Speed window as follows:

  1. If you haven’t already done so, build your app by selecting Build > Make Project from the menu bar.
  2. Select View > Tool Windows > Build from the menu bar.
  3. In the Build window, open the Build Speed window in one of the following ways:
    • After Android Studio finishes building your project, click the Build Speed tab.
    • After Android Studio finishes building your project, click the link in the right side of the Build Output window.

The Build Speed window organizes possible build issues in a tree on the left. You can inspect and click on each issue to investigate its details in the panel on the right. When Android Studio analyzes your build, it computes the set of tasks that determined the build’s duration and provides a visualization to help you understand the impact of each of these tasks. You can also get details on warnings by expanding the Warnings node.

Build speed chart

Which tasks determine build duration?

Gradle determines task execution by task interdependencies, project structure, and CPU load, and executes tasks either sequentially or in parallel. For a given build, the Build Speed window highlights the set of sequentially executed tasks that determined the duration of the current build. Addressing inefficiencies in these highlighted tasks is the best starting point for reducing your overall build time.

Keep in mind, you might see a different set of tasks determining build duration with each build you execute. For example, if you make changes to the build configuration, run a build with a different set of tasks (such as an incremental build), or run a build under different constraints (for example, heavier CPU load), the Build Speed window may highlight a different set of tasks that most impacted that build’s duration. Because of this variability, you might want to use the Build Speed window across multiple builds to consistently reduce build duration.

Live Layout Inspector

Debug your layout with an updated Live Layout Inspector that provides complete, real-time insights into your app’s UI while it’s deployed to a device.

To open a Layout Inspector window, go to View > Tools Windows > Layout Inspector. Along with many of the same features of the existing Layout Inspector, the Live Layout Inspector also includes:

  • Dynamic layout hierarchy: Updates as the views on the device change.

Dynamic layout hierarchy

  • Property values resolution stack: Investigate where a resource property value originates in the source code and navigate to its location by following the hyperlinks in the properties pane.

Property values resolution stack

  • 3D view: See your app’s view hierarchy at runtime with advanced 3D visualization. To use this feature, in the Live Layout Inspector window simply click on the Layout and rotate it.

Layout inspector: 3D view

You can use the Live Layout Inspector only when deploying your app to devices running API level 29 or higher. You must also enable the feature by navigating to File > Settings > Experimental, and checking the box next to Enable Live Layout Inspector.

Multi Preview

Multi Preview is a visual tool for simultaneously previewing layouts in different devices and configurations, which can help catch potential issues in your layouts.

You can access this feature by clicking on the Multi Preview tab in the top-right corner of the IDE window:

Multi Preview tab

You can select from two different configuration sets: Pixel devices and project locales. To switch between these configuration sets, select from the dropdown menu at the top of the Multi Preview window:

Multi Preview demonstration

Java 8 library desugaring in D8 and R8

Android Studio now includes support for using a number of Java 8 language APIs without requiring a minimum API level for your app.

Through a process called desugaring, the DEX compiler, D8, in Android Studio 3.0 and higher already provided substantial support for Java 8 language features (such as lambda expressions, default interface methods, try with resources, and more). In Android Studio 4.0, the desugaring engine has been extended to be able to desugar Java language APIs. This means that you can now include standard language APIs that were available only in recent Android releases (such as java.util.streams) in apps that support older versions of Android.

The following set of APIs is supported in this release:

  • Sequential streams (
  • A subset of java.time
  • java.util.function
  • Recent additions to java.util.{Map,Collection,Comparator}
  • Optionals (java.util.Optional, java.util.OptionalInt and java.util.OptionalDouble) and some other new classes useful with the above APIs
  • Some additions to java.util.concurrent.atomic (new methods on AtomicInteger, AtomicLong and AtomicReference)
  • ConcurrentHashMap (with bug fixes for Android 5.0)

To support these language APIs, D8 compiles a separate library DEX file that contains an implementation of the missing APIs and includes it in your app. The desugaring process rewrites your app’s code to instead use this library at runtime.

To enable support for these language APIs, include the following in your module’s build.gradle file:

android {
  defaultConfig {
    // Required when setting minSdkVersion to 20 or lower
    multiDexEnabled true

  compileOptions {
    // Flag to enable support for the new language APIs
    coreLibraryDesugaringEnabled true
    // Sets Java compatibility to Java 8
    sourceCompatibility JavaVersion.VERSION_1_8
    targetCompatibility JavaVersion.VERSION_1_8

dependencies {
  coreLibraryDesugaring ''

Let us know if you run into issues or if there are other APIs you want supported by filing bugs bugs on our bug tracker.

Support for Kotlin DSL script files

The Android Gradle plugin now supports Kotlin DSL build script files (*.kts). When used with Android Studio, certain IDE features, such as the Project Structure dialog and build script quick fixes, now also support reading and writing to Kotlin build script files.

Smart editor features for ProGuard rules

Android Studio now provides smart editor features when you open ProGuard rules files, such as syntax highlighting, code completion, and error checking. The editor also integrates with your Android Studio project to provide full symbol completion for all classes, methods, and fields, and includes quick navigation and refactoring.

Smart editor features when editing ProGuard rules files

New Motion Editor

Android Studio now includes a visual design editor for the MotionLayout layout type, making it easier to create and preview animations.

The Motion Editor provides a simple interface for manipulating elements from the MotionLayout library that serves as the foundation for animation in Android apps. In previous releases, creating and altering these elements required manually editing constraints in XML resource files. Now, the Motion Editor can generate this XML for you, with support for start and end states, keyframes, transitions, and timelines.

To get started with the Motion Editor:

  1. Create a ConstraintLayout.
  2. Right-click on the preview in the Layout Editor.
  3. Click Convert to MotionLayout, as shown below.

After Android Studio converts your ConstraintLayout to MotionLayout, a Motion Scene file is also added to the directory containing your XML.

The MotionLayout then becomes your root layout, and it appears in the Motion Editor UI. The layout already includes a start ConstraintSet, end ConstraintSet, and a transition going from start to end.

You can use the overview graphic to select a ConstraintSet or Transition and to select components on the selection panel.

Then you can edit the constraints and attributes of either the start or end ConstraintSet the same way you would edit a ConstraintLayout.

If you want to build more elements to your graph, you can use the creation icons to quickly add a ConstraintSet, Transition, or OnClick/OnSwipe gestures.

To add a keyframe, first click on the Transition arrow:

Then, in the Transition timeline pane, click on the top-right corner and select KeyPosition:

This action opens a dialog where you can set attributes for the keyframe.

You can also add OnClick and OnSwipe handlers to the Transition in the attribute panel.

This action opens a dialog where you can set attributes of the click such as target components and drag direction.

The Motion Editor supports previewing animations on the design surface. When an animation is selected, click Play above the timeline to preview the animation.

New in Android Gradle plugin 4.0.0

This section describes new features and behavior changes included in Android Gradle plugin 4.0.0.

New options to enable or disable build features

Android Gradle plugin 4.0.0-alpha05 introduces a new way to control which build features you want to enable and disable, such as View Binding, Data Binding, and Jetpack Compose. When new features are added, they will be disabled, by default. You can then use the buildFeatures block to enable only the features you want, and it helps you optimize the build performance for your project. You can set the options for each module in the module-level build.gradle file, as follows:

android {
    // The default value for each feature is shown below. You can change the value to
    // override the default behavior.
    buildFeatures {
        // Determines whether to enable support for Jetpack Compose.
        compose = false
        // Determines whether to generate a BuildConfig class.
        buildConfig = true
        // Determines whether to support View Binding.
        // Note that the viewBinding.enabled property is now deprecated.
        viewBinding = false
        // Determines whether to support Data Binding.
        // Note that the dataBinding.enabled property is now deprecated.
        dataBinding = false
        // Determines whether to generate binder classes for your AIDL files.
        aidl = true
        // Determines whether to support RenderScript.
        renderScript = true
        // Determines whether to support injecting custom variables into the module’s R class.
        resValues = true
        // Determines whether to support shader AOT compilation.
        shaders = true

You can also specify the default setting for these features across all modules in a project by including one or more of the following in your project’s file, as shown below. Keep in mind, you can still use the buildFeatures block in the module-level build.gradle file to override these project-wide default settings.


Feature-on-feature dependencies

In previous versions of the Android Gradle plugin, all Dynamic Feature modules could depend only on the app's base module. When using Android Gradle plugin 4.0.0, you can now include a feature module that depends on another feature module. That is, a :video feature can depend on the :camera feature, which depends on the base module, as shown in the figure below.

Feature on feature dependencies

Dynamic feature :video depends on feature :camera, which depends on the base :app module.

This means that when your app requests to download a dynamic feature module, the app also downloads other feature modules it depends on. After you create dynamic feature modules for your app, you can declare a feature-on-feature dependency in the module’s build.gradle file. For example, the :video module declares a dependency on :camera as follows:

// In the build.gradle file of the ':video' module.
dependencies {
    // All dynamic feature modules must declare a dependency
    // on the base module.
    implementation project(':app')
    // Declares that this module also depends on the 'camera'
    // dynamic feature module.
    implementation project(':camera')

Additionally, you should enable the feature-on-feature dependency feature in Android Studio (to support the feature when editing the Run configuration, for example) by clicking Help > Edit Custom VM Options from the menu bar and including the following:


'feature' and 'instantapp' Android Gradle plugins removed

Android Gradle plugin 3.6.0 deprecated the Feature plugin ( and the Instant App plugin ( in favor of using the Dynamic Feature plugin ( to build and package your instant apps using Android App Bundles.

In Android Gradle plugin 4.0.0-alpha01 and higher, these deprecated plugins are fully removed. So, to use the latest Android Gradle plugin, you need to migrate your instant app to support Android App Bundles. By migrating your instant apps, you can leverage the benefits of app bundles and simplify your app's modular design.

Kotlin Android live templates

Android Studio now includes Android live templates for your Kotlin classes. For example, you can now type toast and press the Tab key to quickly insert a Toast. For a full list of available live templates, click File > Settings from the menu bar (or Android Studio > Preferences on macOS) and navigate to Editor > Live Templates.

Fragment wizard and new fragment templates

A New Android Fragment wizard and new fragment templates are now available when you navigate to File > New > Fragment > Gallery or click Create new destination in the Navigation editor.

The Fragment gallery wizard.

The Fragment gallery wizard.

Import native libraries from AAR dependencies

Starting with Android Gradle Plugin 4.0 Canary 9, you can import C/C++ libraries from your app's AAR dependencies. When you follow the configuration steps described below, Gradle automatically makes these native libraries available to use with your external native build system, such as CMake. Note that Gradle only makes these libraries available to your build; you must still configure your build scripts to use them.

Libraries are exported using the Prefab package format.

Each dependency can expose at most one Prefab package, which comprises one or more modules. A Prefab module is a single library, which could be either a shared, static, or header only library.

Typically, the package name matches the Maven artifact name and the module name matches the library name, but this is not always true. Because you need to know the package and module name of the libraries, you might need to consult the dependency's documentation to determine what those names are.

Configure your external native build system

To see the steps you need to follow, click on the external native build system you plan to use.

Native dependencies included in an AAR are exposed to your CMake project via CMAKE_FIND_ROOT_PATH. This value will be set automatically by Gradle when CMake is invoked, so if your build modifies this variable be sure to append rather than assign to it.

Each dependency exposes a config-file package to your CMake build, which you import with the find_package command. This command searches for config-file packages matching the given package name and version and exposes the targets it defines to be used in your build. For example, if your application defines and it uses curl, you should include the following in your CMakeLists.txt file:

add_library(app SHARED app.cpp)

# Add these two lines.
find_package(curl REQUIRED CONFIG)
target_link_libraries(app curl::curl)

You can now specify #include "curl/curl.h" in app.cpp. When you build your project, your external native build system automatically links against and packages in the APK or app bundle.

Known Issues for 4.0 Preview

This section describes current known issues in Android Studio 4.0 Preview.

Missing Run, Debug, and Profile toolbar buttons

If you have customized the Run/Debug group of action buttons—for example, by modifying options under Appearance & Behavior > Menus and Toolbars in the Settings or Preferences window—those action buttons might disappear from the toolbar after you restart the IDE. This is a known issue in the version of IntelliJ that Android Studio 4.0 is built on (see issue IDEA-228450).

To resolve this issue, revert any customizations you have made to those buttons as follows:

  1. Select File > Settings (or Android Studio > Preferences on macOS).
  2. On the left of the window, navigate to Appearance & Behavior > Menus and Toolbars.
  3. On the right side of the window, navigate to Main Toolbar > Toolbar Run Actions and select Run/Debug.
  4. Near the top of the window, click Revert. and select Restore Run/Debug.
  5. Click OK. You should now see the missing buttons in the toolbar.

Patches Not Available for Canary 5

No patches for Android Studio 4.0 Canary 5 are available for previously released Android Studio 4.0 Canary versions. To install Android Studio 4.0 Canary 5, please download it from the Android Studio downloads page.

Profilers and Live Layout Inspector in Canary 5

Starting with Android Studio 4.0 Canary 5, the Live Layout Inspector and the Profilers do not function correctly on Windows, causing the following error message:

transfer error: couldn't create file: Read-only file system.

To fix this issue, upgrade to Android Studio 4.0 Canary 7 or higher.

Missing Kotlin Maven repo

If you are using Android Studio 4.0 Canary 4 or lower, you might see the following error message:

Application build has failed with an error (Could not find org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.3.60-eap-25)

To resolve this issue, update to Android Studio 4.0 Canary 5 or higher.

IllegalStateException when deploying app with native dependencies

If your app includes native dependencies and has androidParallelJsonGen=true (the default), you will encounter an IllegalStateException exception when you deploy your app from Android Studio. To work around this issue, set android.enableParallelJsonGen=false in your project's file. See Issue 149575364 for more details.

Issues including native dependencies

The Android Gradle plugin currently defaults to an older version of Prefab with a couple known issues:

  • Paths to libraries are incorrectly escaped on Windows.
  • The CMake plugin exports static libraries incorrectly.

The latest version of Prefab has fixes for these issues. To use the latest version of Prefab, set android.prefabVersion to 1.0.0-alpha5 or higher in your project's file.