Android Dev Summit, October 23-24: two days of technical content, directly from the Android team. Sign-up for livestream updates.

New features in Android Studio Preview

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

Android Studio 3.6 is currently in the Canary, Dev, and Beta 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 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.