It's happening now, watch the livestream.

New features in Android Studio Preview

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

Android Studio 4.0 is currently in the Canary and Dev channels, and Android Studio 3.6 is currently in the Beta channel.

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.

Support for Jetpack Compose

Jetpack Compose toolkit provides a modern approach to building your app's UI. The toolkit also brings all of Kotlin's benefits, such as helping you to write concise and idiomatic code that's fully interoperable with Java.

For the best experience developing with Jetpack compose, you should use the latest version of Android Studio 4.0. That’s because when you use Android Studio to develop your app with Jetpack Compose, you can benefit from smart editor features, such as New Project templates and the ability to immediately preview your Compose UI.

To learn more and get started, go to the Jetpack Compose overview.

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 (java.util.stream)
  • 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
  }
}

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, create a ConstraintLayout, right-click on the preview in the Layout Editor, and click Convert to MotionLayout, as shown below.

After the MotionLayout is created, you can edit the constraints and attributes of the start and end frames the same way you would edit a ConstraintLayout.

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.

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:

-Drundebug.feature.on.feature=true

'feature' and 'instantapp' Android Gradle plugins removed

Android Gradle plugin 3.6.0 deprecated the Feature plugin (com.android.feature) and the Instant App plugin (com.android.instantapp) in favor of using the Dynamic Feature plugin (com.android.dynamic-feature) 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.

Known Issues for 4.0 Preview

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

Missing Kotlin Maven repo

If you upgrade an existing project to use Android Studio 4.0, 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, include the following in your project's top-level build.gradle file:

buildscript {
    repositories {
        ...
        maven { url 'https://dl.bintray.com/kotlin/kotlin-eap' }
    }
}

allprojects {
    repositories {
        ...
        maven { url 'https://dl.bintray.com/kotlin/kotlin-eap' }
    }
}

Android Studio 3.6

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

Split view in design editors

Design editors, such as the Layout Editor and Navigation Editor, now provide a Split view that enables you to see both the Design and Code views of a your UI at the same time. To enable split view, click the Split icon split view icon in the top-right corner of the editor window.

split view shows both the design and text views at the same time

Leak detection in Memory Profiler

When analyzing a heap dump in the Memory Profiler, you can now filter profiling data that Android Studio thinks might indicate memory leaks for Activity and Fragment instances in your app.

The types of data that the filter shows include the following:

  • Activity instances that have been destroyed but are still being referenced.
  • Fragment instances that do not have a valid FragmentManager but are still being referenced.

In certain situations, such as the following, the filter might yield false positives:

  • A Fragment is created but has not yet been used.
  • A Fragment is being cached but not as part of a FragmentTransaction.

To use this feature, first capture a heap dump or import a heap dump file into Android Studio. To display the fragments and activities that may be leaking memory, select the Activity/Fragment Leaks checkbox in the heap dump pane of the Memory Profiler.

Profiler: Memory Leak Detection

Filtering a heap dump for memory leaks.

Apply Changes

You can now add a class and then deploy that code change to your running app by clicking either Apply Code Changes Apply Code Changes icon or Apply Changes and Restart Activity Apply Changes icon.

To learn more about the difference between these two actions, see Apply Changes.

NDK updates

The following updates support native (C/C++) development in Android Studio.

Kotlin support

The following NDK features in Android Studio, previously supported in Java, are now also supported in Kotlin:

  • Navigate from a JNI declaration to the corresponding implementation function in C/C++. View this mapping by hovering over the C or C++ item marker near the line number in the managed source code file.
  • Automatically create a stub implementation function for a JNI declaration. Define the JNI declaration first and then type “jni” or the method name in the C/C++ file to activate.

  • Unused native implementation functions are highlighted as a warning in the source code. JNI declarations with missing implementations are also highlighted as an error.

  • When you rename (refactor) a native implementation function, all corresponding JNI declarations are updated. Rename a JNI declaration to update the native implementation function.

  • Signature checking for implicitly-bound JNI implementations.

Other JNI improvements

  • Cosmetics

    • Type hints for parameter and return values are shown in JNI implementation functions.
    • JNI-mangled function names can be folded.

  • RegisterNatives support

    • Auto-completion for the method declaration name, parameter types, and return type.

    • Rename refactoring of the method declaration name.

    • Signature-checking for bound JNI functions.

  • Other JNI function assistance

    • Auto-completion, inspection, navigation, and rename refactoring support for string literals in the following:
      • FindClass
      • GetMethodID and GetStaticMethodID
      • GetFieldID and GetStaticFieldID
    • Various inspections for the following:
      • Call[Static]<type>Method
      • CallNonvirtual<type>Method
      • Get[Static]<type>Field
      • NewObject

Updates to the Android Gradle plugin

The following updates are available when you use the latest preview version of the Android Gradle plugin.

Support for the Maven Publish plugin

Android Gradle plugin 3.6-alpha07 and higher includes support for the Maven Publish Gradle plugin, which allows you to publish build artifacts to an Apache Maven repository. The Android Gradle plugin creates a component for each build variant artifact in your app or library module that you can use to customize a publication to a Maven repository.

The components that the Android plugin creates depend on whether the module uses the application or library plugin, as described in the table below.

Android Gradle plugin Publication artifact Component name
com.android.library AAR components.variant
com.android.application A ZIP of APK(s), and available ProGuard or R8 mappings files components.variant_apk
com.android.application An Android App Bundle (AAB) components.variant_aab

The following code sample creates a publication for the release and debug build variants of an AAR library. Each publication applies the matching component and customizes attributes of the generated POM, such as the Maven coordinates.

// Because the components are created only during the afterEvaluate phase, you must
// configure your publications using the afterEvaluate() lifecycle method.
afterEvaluate {
    publishing {
        publications {
            // Creates a Maven publication called "release".
            release(MavenPublication) {
                // Applies the component for the release build variant.
                from components.release

                // You can then customize attributes of the publication as shown below.
                groupId = 'com.example.MyLibrary'
                artifactId = 'final'
                version = '1.0'
            }
            // Creates a Maven publication called “debug”.
            debug(MavenPublication) {
                // Applies the component for the debug build variant.
                from components.debug

                groupId = 'com.example.MyLibrary'
                artifactId = 'final-debug'
                version = '1.0'
            }
        }
    }

To create a publication that publishes your app as either a ZIP file of APKs or an Android App Bundle (AAB), simply use the appropriate component, as shown below.

afterEvaluate {
    publishing {
        publications {
            paidRelease(MavenPublication) {
              // The following applies a component to this publication
              // which results in publishing an app bundle.
              from components.paidRelease_aab

              groupId = 'com.example.MyApp'
              artifactId = 'paid-release-aab'
              version = '1.0'
            }
            paidDebug(MavenPublication) {
              // The following applies a component to this publication
              // which results in publishing APKs in a ZIP file.
              from components.paidDebug_apk

              groupId = 'com.example.MyApp'
              artifactId = 'paid-debug-apks'
              version = '1.0'
            }
        }
    }

After you create publications, the Maven Publish plugin creates publishing tasks that you can use to publish your artifact to the repositories that you specify.

New default packaging tool

When using Android Gradle plugin 3.6.0-alpha09 or higher to build the debug version of your app, the plugin uses a new packaging tool, called zipflinger, to build your APK. This new tool should provide build speed improvements. However, if you experience issues, please report a bug. You can also revert to using the old packaging tool by including the following in your gradle.properties file:

android.useNewApkCreator=false

Refactor menu option to enable Instant Apps support

You can now instant-enable your base module at any time after creating your app project as follows:

  1. Open the Project panel by selecting View > Tool Windows > Project from the menu bar.
  2. Right-click on your base module, typically named 'app', and select Refactor > Enable Instant Apps Support.
  3. In the dialog that appears, select your base module from the dropdown menu.
  4. Click OK.

To learn more, read Overview of Google Play Instant.

Deobfuscate class and method bytecode in APK Analyzer

When inspecting DEX files, the APK Analyzer now supports deobfuscating class and method bytecode. To deobfuscate the bytecode, proceed as follows:

  1. Select Build > Analyze APK from the menu bar.
  2. In the dialog that appears, navigate to the APK you want to inspect and select it.
  3. Click Open.
  4. In the APK Analyzer, select the DEX file you want to inspect.
  5. In the DEX file viewer, load the ProGuard mappings file for the APK you’re analyzing.
  6. Right-click on the class or method you want to inspect and select Show bytecode.

View binding

View binding provides compile-time safety when referencing views in your code. You can now replace findViewById() with the auto-generated binding class reference.

To start using View binding, include the following in each module's build.gradle file:

android {
    viewBinding.enabled = true
}

To learn more, read the View Binding documentation. If you have any feedback or encounter any issues, please report a bug.

Resumable SDK downloads

When downloading SDK components and tools using the SDK Manager, Android Studio now allows you to resume downloads that were interrupted (for example, due to a network issue) instead of restarting the download from the beginning. This enhancement is especially helpful for large downloads, such as the Android Emulator or system images, when internet connectivity is unreliable.

In addition, if you have an SDK download task running in the background, you can now pause or resume the download using the controls in the status bar.

A background download task in the status bar with new controls that
          let you pause or resume the download.

A background download task in the status bar with new controls that let you pause or resume the download.

IntelliJ IDEA 2019.2

The core Android Studio IDE has been updated with improvements from IntelliJ IDEA through the 2019.2 release, such as the Services tool window.

To learn more about the improvements from other IntelliJ versions that are included cumulatively with version 2019.2, see the following pages:

New location to toggle Gradle's offline mode

To enable or disable Gradle's offline mode, first select View > Tool Windows > Gradle from the menu bar. Then, near the top of the Gradle window, click Toggle Offline Mode Gradle offline button in the Gradle panel..

Known Issues for 3.6 Preview

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

Small UI text on Chrome OS

On Chrome OS, text might appear much smaller than in previous releases. To work around this issue, do the following:

  1. Open the Settings window by clicking File > Settings (on macOS, Android Studio > Preferences)
  2. Navigate to Appearance & Behavior > Appearance.
  3. Select Use custom font.
  4. Increase the font size.
  5. In the Settings window, navigate to Editor > Font.
  6. Increase the font size.
  7. Click OK.