New features in Android Studio Preview

This page lists the new features introduced in Android Studio preview releases. The preview builds provide early access to the latest features and improvements in Android Studio. You can download these preview versions here. 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.

For the latest news on Android Studio preview releases, including a list of notable fixes in each preview release, see the Release Updates in the Android Studio blog.

Current versions of Android Studio

The following table lists the current versions of Android Studio and their respective channels.

Version Channel
Android Studio Hedgehog | 2023.1.1 Stable
Android Gradle plugin 8.2.2 Stable
Android Studio Iguana | 2023.2.1 Beta
Android Studio Jellyfish | 2023.3.1 Canary

Compatibility with Android Gradle plugin previews

Each preview version of Android Studio is published alongside a corresponding version of the Android Gradle plugin (AGP). Preview versions of Studio should work with any compatible stable version of AGP. However, if you're using a preview version of AGP, you must use the corresponding preview version of Studio (for example, Android Studio Chipmunk Canary 7 with AGP 7.2.0-alpha07). Attempts to use divergent versions (for example, Android Studio Chipmunk Beta 1 with AGP 7.2.0-alpha07) will cause a Sync failure, which results in a prompt to update to the corresponding version of AGP.

For a detailed log of Android Gradle plugin API deprecations and removals, see the Android Gradle plugin API updates.

Android Studio Iguana | 2023.2.1

The following are new features in Android Studio Iguana. To see what's been fixed in this version of Android Studio, see the closed issues.

Introducing Studio Bot

Studio Bot is your coding companion for Android development. It's an AI-powered conversational experience in Android Studio that helps you be more productive by answering Android development queries. To learn more, see Meet Studio Bot.

Launch Android Studio in Safe Mode

Android Studio Hedgehog introduces the ability to launch Android Studio in Safe Mode. This mode can be useful if you run into a situation where certain features don't work or the entire IDE fails to launch, which can sometimes be caused by custom configurations, environment variables, or plugins that are incompatible with Android Studio.

Using Safe Mode temporarily returns the IDE to a set of default configurations that might allow it to launch, so that you can troubleshoot from there to identify the issue and restore functionality. Safe Mode attempts to open Android Studio with limited functionality by taking actions including the following:

  • Disables third-party plugins
  • Restores bundled Kotlin plugin to the version originally included with Studio
  • Temporarily resets configurations, for example in the studio.vmoptions file
  • Validates environment variables that can prevent startup, such as JRE_HOME and TMP
  • Reverts the JRE to a compatible version if needed

To launch Android Studio in Safe Mode, follow these steps:

  1. Find the Safe Mode script.
    • On Windows, navigate to AndroidStudio/bin and find the studio_safe.bat script.
    • On macOS, navigate to Android Studio/Contents/bin and find the studio_safe.sh script.
    • On Linux, navigate to android-studio/bin and find the studio_safe.sh script.
  2. Run the script: open the command line and type studio_safe.bat (studio_safe.sh for macOS or Linux), and press Enter.

Version control system integration in App Quality Insights

App Quality Insights now lets you navigate from a Crashlytics stack trace to the relevant code—at the point in time when the crash happened. AGP attaches git commit hash data to crash reports to help Android Studio navigate to your code and show how it was in the version where the issue occurred. When you view a crash report in App Quality Insights, you can choose to navigate to the line of code in your current git checkout or view a diff between the current checkout and the version of your codebase that generated the crash.

To integrate your version control system with App Quality Insights, you need the following minimum requirements:

To use version control integration, enable the android.enableVcsInfo flag in the gradle.properties file:

android.enableVcsInfo=true

Now, when you build your app and publish to Google Play, crash reports include the data necessary for the IDE to link to previous versions of your app from the stack trace.

Compose UI Check

To help developers build more adaptive and accessible UI in Jetpack Compose, Android Studio Iguana Canary 5 introduced a new UI Check mode in Compose Preview. This feature works similar to Visual linting and Accessibility checks integrations for views. Activate Compose UI check mode for Android Studio to automatically audit your Compose UI and check for adaptive and accessibility issues across different screen sizes, such as text stretched on large screens or low color contrast. The mode highlights issues found in different preview configurations and list them in the problems panel.

Try out this feature today by clicking on the UI Check icon on Compose Preview and send your feedback:

Known issues of UI Check Mode:

  • Selection of issue in the problem panel may lose focus
  • 'Suppress rule' does not work

Progressive Rendering for Compose Preview

Android Studio Iguana Canary 3 introduces Progressive Rendering in Compose Preview. As part of a continual effort to make previews more performant, now for any preview that is out of view, we purposely decrease their render quality to save memory used.

This feature is developed with the goal to further improve the usability of Previews by being able to handle more previews at the same time in a file-try it out today and submit your feedback.

Test against configuration changes with the Espresso Device API

Use the Espresso Device API to test your app when the device undergoes common configuration changes, such as rotation and screen unfolding. The Espresso Device API lets you simulate these configuration changes on a virtual device and executes your tests synchronously, so only one UI action or assertion happens at a time and your test results are more reliable. If you're new to writing UI tests with Espresso, see its documentation.

To use the Espresso Device API, you need the following:

  • Latest Canary version of Android Studio Iguana
  • Latest Alpha version of Android Gradle Plugin 8.3
  • Android Emulator 33.1.10 or higher
  • Android virtual device that runs API level 24 or higher

Set up your project for the Espresso Device API

To set up your project so it supports the Espresso Device API, do the following:

  • To let the test pass commands to the test device, add the INTERNET and ACCESS_NETWORK_STATE permissions to the manifest file in the androidTest source set:

      <uses-permission android:name="android.permission.INTERNET" />
      <uses-permission android:name="android.permissions.ACCESS_NETWORK_STATE" />
      
  • Enable the enableEmulatorControl experimental flag in the gradle.properties file:

      android.experimental.androidTest.enableEmulatorControl=true
      
  • Enable the emulatorControl option in the module-level build script:

    Kotlin

      testOptions {
        emulatorControl {
          enable = true
        }
      }
      

    Groovy

      testOptions {
        emulatorControl {
          enable = true
        }
      }
      
  • In the module-level build script, import the Espresso Device library into your project:

    Kotlin

      dependencies {
        androidTestImplementation("androidx.test.espresso:espresso-device:1.0.0-alpha07")
      }
      

    Groovy

      dependencies {
        androidTestImplementation 'androidx.test.espresso:espresso-device:1.0.0-alpha07'
      }
      

Test against common configuration changes

The Espresso Device API has multiple screen orientation and foldable states that you can use to simulate device configuration changes.

Test against screen rotation

Here's an example of how to test what happens to your app when the device screen rotates:

  1. First, for a consistent starting state set the device to portrait mode:

      import androidx.test.espresso.device.action.ScreenOrientation
      import androidx.test.espresso.device.rules.ScreenOrientationRule
      ...
      @get:Rule
      val screenOrientationRule: ScreenOrientationRule = ScreenOrientationRule(ScreenOrientation.PORTRAIT)
      
  2. Create a test that sets the device to landscape orientation during test execution:

      @Test
      fun myRotationTest() {
        ...
        // Sets the device to landscape orientation during test execution.
        onDevice().setScreenOrientation(ScreenOrientation.LANDSCAPE)
        ...
      }
      
  3. After the screen rotates, check that the UI adapts to the new layout as expected.

      @Test
      fun myRotationTest() {
        ...
        // Sets the device to landscape orientation during test execution.
        onDevice().setScreenOrientation(ScreenOrientation.LANDSCAPE)
        composeTestRule.onNodeWithTag("NavRail").assertIsDisplayed()
        composeTestRule.onNodeWithTag("BottomBar").assertDoesNotExist()
      }
      
Test against screen unfolding

Here's an example of how to test what happens to your app if it's on a foldable device and the screen unfolds:

  1. First, test with the device in the folded state by calling onDevice().setClosedMode(). Make sure that your app's layout adapts to the compact screen width.

      @Test
      fun myUnfoldedTest() {
        onDevice().setClosedMode()
        composeTestRule.onNodeWithTag("BottomBar").assetIsDisplayed()
        composeTestRule.onNodeWithTag("NavRail").assetDoesNotExist()
        ...
      }
      
  2. To transition to a fully unfolded state, call onDevice().setFlatMode(). Check that the app’s layout adapts to the expanded size class.

      @Test
      fun myUnfoldedTest() {
        onDevice().setClosedMode()
        ...
        onDevice().setFlatMode()
        composeTestRule.onNodeWithTag("NavRail").assertIsDisplayed()
        composeTestRule.onNodeWithTag("BottomBar").assetDoesNotExist()
      }
      

Specify what devices your tests need

If you're running a test that performs folding actions on a device that isn't foldable, the test will likely fail. To execute only the tests that are relevant to the running device, use the @RequiresDeviceMode annotation. The test runner automatically skips running tests on devices that don't support the configuration being tested. You can add the device requirement rule to each test or an entire test class.

For example, to specify that a test should only be run on devices that support unfolding to a flat configuration, add the following @RequiresDeviceMode code to your test:

@Test
@RequiresDeviceMode(mode = FLAT)
fun myUnfoldedTest() {
  ...
}

Baseline Profiles module wizard

Starting with Android Studio Iguana, you can generate Baseline Profiles for your app using the Baseline Profile Generator template in the new module wizard (File > New > New Module).

This template sets up your project so that it can support Baseline Profiles. It uses the new Baseline Profiles Gradle plugin, which automates the process of setting up your project in the required way with one Gradle task.

The template also creates a run configuration that lets you generate a Baseline Profile with one click from the Select Run/Debug Configuration drop-down list.

Support for Gradle Version Catalogs

Android Studio Giraffe introduces support for TOML-based Gradle Version Catalogs, a feature that lets you manage dependencies in one central location and share dependencies across modules or projects. Android Studio now makes it easier to configure version catalogs through editor suggestions and integration with the Project Structure dialog. To learn how to update to Gradle Version Catalogs, see Migrate your build to version catalogs.

Code completion and navigation

Android Studio offers code completion when you're editing a version catalog in the TOML file format or adding a dependency from a version catalog to a build file. To use code completion, press Ctrl+Space (Command+Space on macOS). In addition, quickly navigate from a dependency reference in your app's build.gradle file to where it's declared in the version catalog by pressing Ctrl+b (Command+b on macOS).

Code completion when adding a dependency

Integration with the Project Structure dialog

If your project uses a version catalog defined in the TOML file format, you can edit variables you've defined there through the Project Structure dialog Variables view (File > Project Structure > Variables) in Android Studio. For each version catalog, there is a drop-down that lists the variables from that catalog. To edit a variable, click on its value and overwrite it. When you save these changes, the TOML file is updated accordingly.

Variables from a version catalog in the Project Structure dialog

You can also update dependencies in the Project Structure dialog Dependencies view (File > Project Structure > Dependencies). To update versions using the Project Structure dialog, navigate to the module and dependency you want to edit, and then update the Requested Version field. When you save these changes, the TOML file is updated accordingly. Note that if the dependency version was defined using a variable, updating the version directly this way replaces the variable with a hardcoded value. Also be aware that removing a dependency from a build file, whether you use the Project Structure dialog or not, doesn't remove the dependency from the version catalog.

Dependencies from a version catalog in the Project Structure dialog

Known issues and limitations

The following are known issues or limitations with Gradle Version Catalogs support in Android Studio.

Error highlighting plugin alias declarations in Kotlin script files

When you add a plugin declaration of the form alias(libs.plugins.example), the editor adds a red underline under the libs part. This is a known issue in Gradle versions 8.0 and lower and will be resolved in a future release of Gradle.

Android Studio support only for version catalogs in TOML format

Currently the Android Studio code completion, navigation, and Project Structure dialog support is only available for version catalogs defined in the TOML file format. However, you can still add a version catalog directly in the settings.gradle file and use its dependencies in your project.

Navigating to a dependency definition in a version catalog by using Control+click (Command+click on macOS) isn't yet supported for build files written using Kotlin script.

Firebase Assistant adds dependencies directly in build scripts

The Firebase Assistant adds dependencies directly to your build scripts instead of through version catalogs.

"Find usages" functionality not supported

Finding usages of a version catalog variable in other build files isn't yet supported, whether the build file is in KTS or Groovy. That is, using Control+click (Command+click on macOS) on a variable definition in a version catalog doesn't lead to the build files where the variable is used.

Project Structure dialog doesn't show catalogs from composite builds

The Project Structure dialog in Android Studio shows multiple catalog files if they're in the root gradle folder, but doesn't show catalogs for a composite build. For example if you have two catalog files, one for your app and one for a composite build, the Project Structure dialog only shows the app catalog file. You can use a composite build, but you have to edit its TOML file directly.

Android Studio compileSdk version support

Android Studio displays a warning if your project uses a compileSdk that isn't supported by the current version of Android Studio. If available, it also suggests moving to a version of Android Studio that supports the compileSdk used by your project. Keep in mind that upgrading Android Studio might also require you upgrade AGP. AGP also displays a warning in the Build tool window if the compileSdk used by your project isn't supported by the current version of AGP.

Additional SDK insights: policy issues

Android Studio displays lint warnings in build.gradle.kts and build.gradle files and in the Project Structure Dialog for public SDKs that have Play policy violations in the Google Play SDK Index. You should update any dependencies that violate Play policies because these violations could prevent you from publishing to the Google Play Console in the future. The policy violation warnings supplement the outdated version warnings displayed by Android Studio.

Android Studio Jellyfish | 2023.3.1

The following are new features in Android Studio Jellyfish. To see what's been fixed in this version of Android Studio, see the closed issues.

Access real devices with Device Streaming in Android Studio

Device Streaming in Android Studio lets you securely connect to remote physical Android devices hosted in Google's secure data centers. Powered by Firebase, it's the fastest and easiest way to test your app against real devices, including the Google Pixel 8 Pro, Pixel Fold, select Samsung devices, and more.

Animation of using Device Streaming in Android Studio.

After connecting to a device, you can deploy your app, view the display, interact with the device (including rotating or unfolding the device), and anything else you might do with a device over a direct ADB over SSL connection—all without leaving Android Studio. When you're done using the device, Google wipes all your data and factory resets the device before making it available to another developer.

During the current open alpha, you can use device streaming at no cost with Firebase projects on either a Spark or Blaze plan. To get started sign into your Developer account from Android Studio and select a Firebase project. If you don't already have a Firebase project, it's easy to create one. To learn more, go to Device Streaming in Android Studio.

New Sign-in flow

When you sign into Android Studio with your Developer account, you benefit from Google developer services—such as viewing Firebase Crashlytics and Android Vitals reports in App Quality Insights, accessing real remote devices with Device Streaming in Android Studio, and writing higher-quality code with Studio Bot—directly from the IDE.

Android Studio Jellyfish makes it easier to add and manage accounts, and provide the IDE with only the permissions required for each feature. To get started do one of the following:

  • Navigate to one of the features mentioned previously and follow the prompts to sign in and provide necessary permissions
  • If you're already signed in, you can manage your accounts and permissions by navigating to Settings/Preferences > Tools > Google Accounts.

New colorblind checks in Compose UI Check

Compose UI Check includes new colorblind simulations and checks, empowering you to craft visually accessible experiences for all users. Simply enter UI Check mode from Compose Preview to view your Compose UI in different types of color vision deficiencies to ensure your designs remain clear and usable.

Compose UI Check Colorblind example

Build a Generative AI app using the Gemini API template

You can now use Android Studio to build an app that implements Generative AI using the Google AI SDK. The Gemini API template in Android Studio lets you incorporate AI-powered features, such as those that rely on text generation and image recognition, in your app to delight your users.

To learn how to get started, see Build your first Generative AI app in Android Studio.

Android Gradle Plugin behavior changes

Starting with Android Gradle Plugin 8.4.0-alpha04, if an Android library project is minified, shrunk program classes will be published for inter-project publishing. This means that if an application depends on the shrunk version of the Android library subprojects, the APK will include shrunk Android library classes. You may need to adjust library keep rules in case there are missing classes in the APK.

In case you are building and publishing an AAR, local jars that your library depends on will be included unshrunk in the AAR, which means code shrinker won't run on them.

To revert to previous behavior, set android.disableMinifyLocalDependenciesForLibraries in gradle.properties and file a bug. Future versions of AGP will remove this flag.

Redirect audio using device mirroring

Starting with Android Studio Jellyfish Canary 5, you can redirect audio from connected physical devices to your computer speakers or headphones. With audio redirection, keep your headphones connected to your computer and listen to both the computer and connected phone without having to manually reconnect to one device and then another. To enable audio redirection, go to Android Studio > Settings > Tools > Device Mirroring and select Redirect audio from local devices. Note that audio is always redirected, regardless of the settings, for Firebase Test Lab devices running Android 12 or higher.