Save the date! Android Dev Summit is coming to Mountain View, CA on November 7-8, 2018.

New features in Android Studio Preview

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

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

Android Studio 3.2 is currently in the Beta channel.

This page provides a summary of the new features and changes in these preview versions.

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.3

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

IntelliJ IDEA 2018.2.2

The core Android Studio IDE has been updated with improvements from IntelliJ IDEA through the 2018.2.2 release.

Android App Bundles now support Instant Apps

Android Studio now includes support for building Android App Bundles with full support for Instant Apps. In other words, you can now build and deploy both installed app and Instant App experiences from a single Android Studio project, and include them in a single Android App Bundle.

If you’re creating a new Android Studio project using the Create New Project dialog, make sure you check the box next to Configure your project > This project will support instant apps. Android Studio then creates a new app project as it normally would, but includes the following properties in your manifest to add instant app support to your app’s base module:

<manifest ... xmlns:dist="http://schemas.android.com/apk/distribution">
    <dist:module dist:instant="true" />
    ...
</manifest>

You can then add dynamic feature modules that are instant app-enabled by selecting File > New > New Module from the menu bar and then selecting Instant Dynamic Feature Module from the Create New Module dialog.

If you already have a project that supports Dynamic Delivery, you can still add instant app-enabled dynamic features using the New Module wizard, as described above. However, keep in mind that doing so also enables instant app support for your app’s base module.

To deploy your app to a local device as an instant app, edit your run configuration and check the box next to General > Deploy as instant app.

Support for Clang-Tidy

Android Studio now includes support for static code analysis using Clang-Tidy for projects that include native code. To enable support for Clang-Tidy, you need to update your NDK to r18 or higher.

You can then enable or re-enable the inspections by opening the Settings or Preferences dialog, navigating to Editor > Inspections > C/C++ > General > Clang-Tidy. When selecting this inspection in the Settings or Preferences dialog, you can also see the list of Clang-Tidy checks the IDE enables and disables by default under the Option section of the right-most panel. To enable additional checks, simply add them to the list and click Apply.

To configure Clang-Tidy with additional options, click Configure Clang-Tidy Checks Options and add them in the dialog that opens.

Updates to the build system

Android Gradle plugin 3.3.0 requires Gradle 4.10 or higher, and includes the following updates.

Improved incremental Java compilation when using annotation processors

This update decreases build times by improving support for incremental Java compilation when using annotation processors.

  • For projects that include Kotlin code: Incremental Java compilation is enabled by default, even if your project uses the data-binding or retro-lambda plugin.
  • For Java-only projects:

    • If the annotation processors you use all support incremental annotation processing, incremental Java compilation is enabled by default.
    • If however, one or more annotation processors do not support incremental builds, incremental Java compilation is not enabled. Instead, you can include the following flag in your gradle.properties file:

      android.enableSeparateAnnotationProcessing=true

      When you include this flag, Gradle executes the annotation processors in a separate task and allows the Android plugin to enable incremental mode for the Java compilation task.

Improved classpath dependency synchronization

When resolving dependencies on your runtime and compile time classpaths, the Android Gradle plugin attempts to fix certain downstream version conflicts for dependencies that appear across multiple classpaths.

For example, if the runtime classpath includes Library A version 2.0 and the compile classpath includes Library A version 1.0, the plugin updates the dependency on the compile classpath to Library A version 2.0 to avoid errors.

However, if the runtime classpath includes Library A version 1.0 and the compile includes Library A version 2.0, the plugin does not downgrade the dependency on the compile classpath to Library A version 1.0, and you still get an error.

Lazy task configuration

The Android Gradle plugin now uses a new task configuration API, which avoids the cost of creating and configuring tasks during Gradle’s configuration phase when those tasks are not going to be executed. This lets the plugin do less work when building just one of many variants in each module.

The Android Gradle plugin’s Variant API includes many task getters, such as variant.getJavaCompile(), that do not implement Gradle’s new task configuration APIs and always trigger the configuration of the task. Please use one of the newer getter APIs that return a TaskProvider instead, such as variant.getJavaCompileProvider().

To learn more about Gradle’s new API and how to migrate to it, read Task Configuration Avoidance.

Show Gradle Daemons dialog

You can now view a list of active Gradle Daemons in Android Studio. To do this, double-press the Shift key to bring up the Search Everywhere dialog, type "Show Gradle Daemons", and click on the Show Gradle Daemons result that appears.

R8 enabled by default

R8 is a new tool for code shrinking and obfuscation that replaces ProGuard, and it's enabled by default. If you experience issues with R8, please report a bug You can disable R8 by adding the following to your project’s gradle.properties file:

android.enableR8 = false

Single-variant project sync

Syncing your project with your build configuration is an important step in letting Android Studio understand how your project is structured. However, this process can be time-consuming for large projects. If your project uses multiple build variants, you can now optimize project syncs by limiting them to only the variant you have currently selected.

You need to use Android Studio 3.3 Canary 6 or higher with Android Gradle Plugin 3.3.0-alpha06 and higher to enable this optimization. When you meet these requirements, the IDE prompts you to enable this optimization when you sync your project.

To enable this optimization manually, click File > Settings > Experimental > Gradle (Android Studio > Preferences > Experimental > Gradle on a Mac) and check Only resolve selected variants.

Updated Project Structure dialog

Android Studio 3.3 Canary 4 introduces updates to the Project Structure dialog. When you open the dialog by selecting File > Project Structure from the menu bar, you can manage how your project is configured with the following new features:

  • Visualize the actual structure of a project, as resolved by Gradle as a project sync. For example, you can visualize the dependency graph of each module.
  • Get notifications when new versions of your library dependencies are available.
  • Configure a project through the dialog UI, without manually editing build.gradle files.

Provide quick feedback

If you've opted into sharing usage statistics to help improve Android Studio, you'll see these two new icons in the status bar at the bottom of the IDE window:

Simply click the icon that best represents your current experience with the IDE. When you do so, the IDE sends usage statistics that allow the Android Studio team to better understand your sentiment. In some cases, such as when you indicate a negative experience with the IDE, you'll have an opportunity to provide additional feedback.

If you haven't already done so, you can enable sharing usage statistics by opening the Settings dialog (Preferences on a Mac), navigating to Appearance & Behavior > System Settings > Data Sharing, and checking Send usage statistics to Google.

Removal of options for C++ customization

The following options have been removed from the Customize C++ Support dialog:

  • Exceptions Support (-fexceptions)
  • Runtime Type Information Support (-ftti)

The respective behaviors are enabled for all projects created through Android Studio.

Android Studio 3.2

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

What's New Assistant

A new assistant informs you about the latest changes in Android Studio.

The assistant opens when you start Android Studio after a fresh installation or update if it detects that there is new information to show. You can also open the assistant by choosing Help > What's new in Android Studio.

Android Jetpack

Android Jetpack helps to accelerate Android development with components, tools, and guidance that eliminate repetitive tasks and enable you to more quickly and easily build high-quality, testable apps. Android Studio includes the following updates to support Jetpack. For more information, see the Jetpack documentation.

The new Navigation Editor integrates with the navigation components of Android Jetpack to provide a graphical view for creating the navigation structure of your app. The Navigation Editor simplifies the design and implementation of navigation between in-app destinations.

In Android Studio 3.2, the Navigation Editor is an experimental feature. To enable the Navigation Editor, click File > Settings (Android Studio > Preferences on Mac), select the Experimental category in the left pane, and check the box next to Enable Navigation Editor.

To learn more, read the Navigation Editor documentation.

AndroidX migration

As part of Jetpack, we are migrating the Android Support Libraries to a new Android extension library using the androidx namespace. For more information, see the AndroidX overview.

Android Studio 3.2 helps you through this process with a new migration feature.

To migrate an existing project to AndroidX, choose Refactor > Migrate to AndroidX. If you have any Maven dependencies that have not migrated to the AndroidX namespace, the Android Studio build system also automatically converts those project dependencies.

The Android Gradle plugin provides the following global flags that you can set in your gradle.properties file:

  • android.useAndroidX: When set to true, this flag indicates that you want to start using AndroidX from now on. If the flag is absent, Android Studio behaves as if the flag were set to false.
  • android.enableJetifier: When set to true, this flag indicates that you want to have tool support (from the Android Gradle plugin) to automatically convert existing third-party libraries as if they were written for AndroidX. If the flag is absent, Android Studio behaves as if the flag were set to false.

Both flags are set to true when you use the Migrate to AndroidX command.

If you want to start using AndroidX libraries immediately and don't need to convert existing third-party libraries, you can set the android.useAndroidX flag to true and the android.enableJetifier flag to false.

Android App Bundle

Android App Bundle is a new upload format that includes all of your app’s compiled code and resources, but defers APK generation and signing to the Google Play Store.

Google Play’s new app serving model, called Dynamic Delivery, then uses your app bundle to generate and serve optimized APKs for each user’s device configuration, so each user downloads only the code and resources they need to run your app. You no longer need to build, sign, and manage multiple APKs, and users get smaller, more optimized downloads.

Additionally, you can add dynamic feature modules to your app project and include them in your app bundle. Through Dynamic Delivery, your users can then download and install your app’s dynamic features on demand.

To build a bundle, choose Build > Build Bundle(s) / APK(s) > Build Bundle(s).

For more information, including instructions for building and analyzing an Android App Bundle, see Getting started with the Android App Bundle.

Sample data in Layout Editor

Many Android layouts have runtime data that can make it difficult to visualize the look and feel of a layout during the design stage of app development. You can now easily see a preview of your view in the Layout Editor filled with sample data. When you add a view, a button appears below the view in the Design window. Click this button to set the design-time view attributes. You can choose from a variety of sample data templates and specify the number of sample items with which to populate the view.

To try using sample data, add a RecyclerView to a new layout, click the design-time attributes button below the view, and choose a selection from the carousel of sample data templates.

Slices

Slices provide a new way to embed portions of your app's functionality in other user interface surfaces on Android. For example, Slices make it possible to show app functionality and content in Google Search suggestions.

Android Studio 3.2 has a built-in template to help you to extend your app with the new Slice Provider APIs, as well as new lint checks to ensure that you're following best practices when constructing the Slices.

To get started right-click a project folder and choose New > Other > Slice Provider.

To learn more, including how to test your Slice interactions, read the Slices getting started guide.

Kotlin 1.2.61

Android Studio 3.2 bundles Kotlin 1.2.61, and the new Android SDK integrates better with Kotlin. For more information, see the Android Developers blog.

IntelliJ IDEA 2018.1.6

The core Android Studio IDE has been updated with improvements from IntelliJ IDEA through the 2018.1.6 release.

Android profilers

Try the following new Android Profiler features in Android Studio 3.2.

Sessions

You can now save Profiler data as sessions to revisit and inspect later. (The profiler keeps your session data until you restart the IDE.)

After you deploy your app by selecting Run > Profile from the main menu, start a new session by clicking and selecting an app process from the dropdown menu, as shown below.

When you record a method trace or capture a heap dump, the IDE adds that data (along with your app's network activity) as a separate entry to the current session, and you can easily switch back and forth between recordings to compare data.

System Trace

In the CPU Profiler, select the new System Trace configuration to inspect your device's system CPU and thread activity. This trace configuration is built on systrace and is useful for investigating system-level issues, such as UI jank.

While using this trace configuration, you can visually mark important code routines in the profiler timeline by instrumenting your C/C++ code with the native tracing API or your Java code with the Trace class.

Inspect JNI references in the Memory Profiler

If you deploy your app to a device running Android 8.0 (API level 26) or higher, you can now inspect memory allocations for your app’s JNI code using the Memory Profiler.

While your app is running, select a portion of the timeline that you want to inspect and select JNI heap from the drop-down menu above the class list, as shown below. You can then inspect objects in the heap as you normally would and double-click objects in the Allocation Call Stack tab to see where the JNI references are allocated and released in your code.

Import, export, and inspect memory heap dump files

You can now import, export, and inspect .hprof memory heap dump files created with the Memory Profiler.

Import your .hprof file by clicking Start new profiler session in the profiler’s Sessions pane and then selecting Load from file. You can then inspect its data in the Memory Profiler as you would any other heap dump.

To save heap dump data to review later, use the Export Heap Dump button at the right of the Heap Dump entry in the Sessions pane. In the Export As dialog that appears, save the file with the .hprof file-name extension.

Record CPU activity during app startup

You can now record CPU activity during your app's startup as follows:

  1. Select Run > Edit Configurations from the main menu.
  2. Under the Profiling tab of your desired run configuration, check the box next to Start recording a method trace on startup.
  3. Select a CPU recording configuration to use from the dropdown menu.
  4. Deploy your app to a device running Android 8.0 (API level 26) or higher by selecting Run > Profile.

Export CPU traces

After you record CPU activity with the CPU Profiler, you can export the data as a .trace file to share with others or inspect later.

To export a trace after you’ve recorded CPU activity, do the following:

  1. Right-click on the recording you want to export from the CPU timeline.
  2. Select Export trace from the dropdown menu.
  3. Navigate to where you want to save the file and click Save.

Import and inspect CPU trace files

You can now import and inspect .trace files created with the Debug API or CPU Profiler. (Currently, you can't import System Trace recordings.)

Import your trace file by clicking Start new profiler session in the profiler’s Sessions pane and then selecting Load from file. You can then inspect its data in the CPU Profiler similar to how you normally would, but there are a few exceptions:

  • CPU activity is not represented along the CPU timeline.
  • The thread activity timeline indicates only where trace data is available for each thread and not actual thread states (such as running, waiting, or sleeping).

Record CPU activity using the Debug API

You can now start and stop recording CPU activity in the CPU Profiler by instrumenting your app with the Debug API. After you deploy your app to a device, the profiler automatically starts recording CPU activity when your app calls startMethodTracing(String tracePath), and the profiler stops recording when your app calls stopMethodTracing(). While recording CPU activity that’s triggered using this API, the CPU Profiler shows Debug API as the selected CPU recording configuration.

Energy Profiler

The Energy Profiler displays a visualization of the estimated energy usage of your app, as well as system events that affect energy usage, such as wakelocks, alarms, and jobs.

The Energy Profiler appears as a new row at the bottom of the Profiler window when you run your app on a connected device or Android Emulator running Android 8.0 (API 26) or higher.

Click the Energy row to maximize the Energy Profiler view. Place your mouse pointer over a bar in the timeline to see a breakdown of energy use by CPU, network, and location (GPS) resources, as well as relevant system events.

Lint checking

Android Studio 3.2 includes many new and improved features for lint checking.

The new lint checks help you to find and identify common code problems, ranging from warnings about potential usability issues to high-priority errors regarding potential security vulnerabilities.

Lint checks for Java/Kotlin interoperability

To make sure that your Java code interoperates well with your Kotlin code, new lint checks enforce the best practices described in the Kotlin Interop Guide. Examples of these checks include looking for the presence of Nullability annotations, use of Kotlin hard keywords, and placing lambda parameters last.

To enable these checks, click File > Settings (Android Studio > Preferences on Mac) to open the Settings dialog, navigate to the Editor > Inspections > Android > Lint > Interoperability > Kotlin Interoperability section, and select the rules that you want to enable.

To enable these checks for command-line builds, add the following to your build.gradle file:

android {
    lintOptions {
        check 'Interoperability'
    }
}

Lint checks for Slices

New lint checks for Slices help to ensure that you are constructing Slices correctly. For example, lint checks warn you if you have not assigned a primary action to a Slice.

New Gradle target

Use the new lintFix Gradle task to apply all of the safe fixes suggested by the lint check directly to the source code. An example of a lint check that suggests a safe fix to apply is SyntheticAccessor.

Metadata updates

Various metadata, such as the service cast check, have been updated for lint checks to work with Android 9 (API level 28).

Warning if running lint on a new variant

Lint now records which variant and version a baseline is recorded with, and lint warns you if you run it on a different variant than the one with which the baseline was created.

Improvements to existing lint checks

Android Studio 3.2 includes many improvements to existing lint checks. For example, the resource cycle checks now apply to additional resource types, and the translation detector can now find missing translations on the fly, in the editor.

Issue IDs more discoverable

Issue IDs are now shown in more places now, including in the Inspection Results window, making it easier for you to find the information that you need to enable or disable specific checks through lintOptions in build.gradle.

For more information, see Configure lint options with Gradle.

Data Binding V2

Data Binding V2 is now enabled by default and is compatible with V1. This means that, if you have library dependencies that you compiled with V1, you can use them with projects using Data Binding V2. However, note that projects using V1 cannot consume dependencies that were compiled with V2.

D8 desugaring

In Android Studio 3.1, we integrated desugaring step into the D8 tool as an experimental feature, reducing overall build time. Now, in Android Studio 3.2, desugaring with D8 is turned on by default.

New code shrinker

R8 is a new tool for code shrinking and obfuscation that replaces ProGuard. You can start using the preview version of R8 by including the following in your project’s gradle.properties file:

android.enableR8 = true

Changed default ABIs for multi-APKs

When building multiple APKs that each target a different ABI, the plugin no longer generates APKs for the following ABIs by default: mips, mips64, and armeabi.

If you want to build APKs that target these ABIs, you must use NDK r16b or lower and specify the ABIs in your build.gradle file, as shown below:

splits {
    abi {
        include 'armeabi', 'mips', 'mips64'
        ...
    }
}

Improved editor features for CMake build files

If you use CMake to add C and C++ code to your project, Android Studio now includes improved editor features while you edit your CMake build scripts, such as the following:

  • Syntax highlighting and code completion: The IDE now highlights and suggests code completion for common CMake commands. Additionally, you can navigate to a file by clicking it while pressing the Control key (Command on Mac).
  • Code reformatting: You can now use IntelliJ’s code reformat option to apply code styles to your CMake build scripts.
  • Safe refactoring: The IDE’s built-in refactoring tools now also check if you are renaming or deleting files that you reference in your CMake build scripts.

When using the Project window in previous versions of Android Studio, you could navigate and inspect only the header files that belong to libraries you build from a local project. With this release, you can now also view and inspect header files included with external C/C++ library dependencies that you import into your app project.

If you already include C/C++ code and libraries in your project, open the Project window on the left side of the IDE by selecting View > Tool Windows > Project from the main menu and select Android from the drop-down menu. In the cpp directory, all headers that are within the scope of your app project are organized under the include node for each of your local C/C++ library dependencies, as shown below.

Native multidex enabled by default

Previous versions of Android Studio enabled native multidex when deploying the debug version of an app to a device running Android API level 21 or higher. Now, whether you’re deploying to a device or building an APK for release, the Android plugin for Gradle enables native multidex for all modules that set minSdkVersion=21 or higher.

AAPT2 moved to Google's Maven repository

Beginning with Android Studio 3.2, the source for AAPT2 (Android Asset Packaging Tool 2) is Google's Maven repository.

To use AAPT2, make sure that you have a google() dependency in your build.gradle file, as shown here:

  buildscript {
      repositories {
          google() // here
          jcenter()
      }
      dependencies {
          classpath 'com.android.tools.build:gradle:3.2.0-rc03'
      }
  } allprojects {
      repositories {
          google() // and here
          jcenter()
  }

The new version of AAPT2 fixes many issues, including improved handling of non-ASCII characters on Windows.

Removal of configuration on demand

The Configure on demand preference has been removed from Android Studio.

Android Studio no longer passes the --configure-on-demand argument to Gradle.

ADB Connection Assistant

The new ADB Connection Assistant provides step-by-step instructions to help you set up and use a device over the Android Debug Bridge (ADB) connection.

To start the assistant, choose Tools > Connection Assistant.

The ADB Connection Assistant provides instructions, in-context controls, and a list of connected devices in a series of pages in the Assistant panel.

Emulator improvements

You can now save and load snapshots of an AVD (Android virtual device) at any time in the Android Emulator, making it fast and easy to return an emulated device to a known state for testing. When you edit an AVD using the AVD Manager, you can specify which AVD snapshot to load when the AVD starts.

Controls for saving, loading, and managing AVD snapshots are now in the Snapshots tab in the emulator's Extended controls window.

For details, see Snapshots.

For additional information on what’s new and changed in the Emulator, see the Emulator release notes.