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 Ladybug | 2024.2.1 Stable
Android Gradle plugin 8.7.0 Stable
Android Studio Ladybug | 2024.2.1 Beta
Android Studio Ladybug Feature Drop | 2024.2.2 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 Ladybug Feature Drop | 2024.2.2

The following are new features in Android Studio Ladybug Feature Drop | 2024.2.2. To see what's been fixed in this version of Android Studio, see the closed issues.

Wear Tiles Animation Preview

Android Studio Ladybug Canary 2+ now supports Wear Tile Animation Previews, making it easier than ever to inspect and debug your tile animations directly within the IDE. This feature builds upon the Wear Tiles Preview support introduced in Android Studio Koala.

To get started:

  1. Update to Android Studio Ladybug Canary 2 or higher.
  2. Add tiles and tooling libraries:
    1. Add the dependencies to your app-level build.gradle.kts file:
            # Required for the previews
            debugImplementation(libs.androidx.tiles.tooling)
            implementation(libs.androidx.tiles.tooling.preview)
            # Dependencies needed to build the tiles
            implementation(libs.androidx.tiles)
            implementation(libs.androidx.protolayout)
            implementation(libs.androidx.protolayout.material)
          
    2. libs.versions.toml file:
          [versions]
          tiles = "1.5.0-alpha01"
          protolayout = "1.3.0-alpha01"
          [libraries]
          androidx-tiles-tooling = { group = "androidx.wear.tiles", name = "tiles-tooling", version.ref = "tiles" }
          androidx-tiles-tooling-preview = { group = "androidx.wear.tiles", name = "tiles-tooling-preview", version.ref = "tiles" }
          androidx-tiles = { group = "androidx.wear.tiles", name = "tiles", version.ref = "tiles" }
          protolayout = { group = "androidx.wear.protolayout", name = "protolayout-proto", version.ref = "protolayout" }
          protolayout-material= { group = "androidx.wear.protolayout", name = "protolayout-material", version.ref = "protolayout" }
          protolayout-expression= { group = "androidx.wear.protolayout", name = "protolayout-expression", version.ref = "protolayout" }
          
  3. Set up Previews for your Tiles Services. Refer to the tiles preview guide for detailed instructions. If your tiles include animations, the Animation Preview will automatically appear, allowing you to inspect and debug them.

This enhancement streamlines your Wear Tile development workflow by providing a visual and interactive way to fine-tune your tile animations within Android Studio.

Motion Editor deprecation

In the upcoming release, we will be deprecating the Motion Editor as part of our ongoing transition from XML to Jetpack Compose. Compose offers a more modern and efficient approach to building animations, and we encourage developers to start using Compose Animation Preview for new projects.

Gemini in the Code Editor

Android Studio Ladybug feature drop introduces a number of new Code Editor features that use Gemini to help you be more productive. To use these features, enable sharing code context with Gemini in your current project.

Gemini Code Transforms

You can now prompt Gemini from the code editor for code suggestions to modify, optimize, or add code to your app as follows:

  1. To see an input field for your prompt, do one of the following from the code editor:
    • Right-click in the code editor and select Gemini > Generate code from the context menu.
    • Highlight code that you want Gemini to modify, right-click in the code editor, and select Gemini > Transform code from the context menu.
    • Press CTRL+\ (Command+\ on macOS)
  2. Prompt Gemini by describing how you want to modify or add to your code and press Enter. After Gemini processes your request, you should see a code diff.
    • For example, you can ask Gemini to simplify complex code by rewriting it, perform very specific code transformations such as "make this code idiomatic," or generate new functions you describe. Android Studio then shows you Gemini's code suggestion as a code diff, so you can review and accept only the suggestions you want.
  3. Review the code diff and do one of the following:
    • Further modify the suggested code by clicking Refine and entering a new prompt.
    • Click Accept All Changes to add the suggested changes to your code.
Prompt Gemini from the code editor for code suggestions.

Rename with Gemini

When using the standard Refactor > Rename action renaming variables, classes,, and methods, Gemini now suggests appropriate names based on the code context.

The Code Editor's Rename Local Variables dialog with name
          suggestions.
Gemini can suggest names for classes, methods, and variables.

Rethink variable names

Gemini can suggest names for all variables in a file or method based on the code context, so that names are more intuitive and descriptive. Simply right-click in the code editor and select Gemini > Rethink variable names. You should see a dialog, where you can review the suggested names and accept only the ones you like.

The Code Editor's Rename Local Variables dialog with alternative
         name suggestions.
Gemini can suggest alternative names for variables in a file.

Generate unit test scenarios

When writing unit tests for your app, Gemini can suggest test scenarios using the context of the code you want to test. When generating unit test scenarios, Gemini includes detailed names and descriptions for your tests, so that you better understand the intention for each suggested test. You need to implement the body of each test yourself.

To generate unit test scenarios, do the following:

  1. Navigate to the class you want to generate unit test scenarios for.
  2. Right-click on the class and select Gemini > Unit test scenarios from the context menu.
  3. In the dialog that appears, select the methods of the class that you want to generate scenarios for, and set the destination package for the tests.
  4. Click OK.
  5. Confirm the destination directory for your tests and click OK
  6. If the test class already exists, confirm whether you want Gemini to suggest updates to the existing file.

After Gemini processes the request, you should see either a new file with the suggested unit tests or a diff for you to accept recommended changes to an existing file.

Suggest commit message

When committing changes to your version control system from the IDE, Gemini can now use the context from the code changes in the current commit and recent past commits to suggest a detailed commit message. To generate a commit message, click the Suggest commit message button above the text input field in the Commit tool window.

Commit dialog showing a suggested message for the commit.
Gemini can suggest a detailed message for your commit.

Analyze crash reports with Gemini in Android Studio

Use Gemini in Android Studio to analyze your App Quality Insights crash reports, generate insights, provide a crash summary, and when possible recommend next steps, including sample code and links to relevant documentation.

Generate all of this information by clicking Show Insights in the App Quality Insights tool window in Android Studio after you enable Gemini from View > Tool Windows > Gemini.

Show insights from Gemini from the App Quality Insights tool window

Google Play SDK Index integration

The Android Studio Google Play SDK Index integration now includes warnings from the Google Play SDK Console. This gives you a complete view of any potential version or policy issues in your dependencies before submitting your app to the Google Play Console.

Android Studio now also displays notes from SDK authors directly in the editor to save you time. When a recommended version or version range is available, Android Studio will also include a quick fix:

Android Studio also displays warnings when a specific SDK version has known security vulnerabilities. This information helps you discover and address these issues during app development so you can follow best practices.

Mock sensor capabilities and values

Android Studio now includes a new sensor panel, which lets you simulate a device having or not having specific sensor capabilities, such as a heart rate sensor, as well as set specific test values for these sensors. Use this panel to test how your app handles devices that have different sensor capabilities. This panel is useful for testing health and fitness apps, especially on Wear OS devices.

Button is near the middle of the panel row
The Wear Health Services panel, available in the emulator.

To open and use the panel, do the following:

  1. Create or open an Android Virtual Device (AVD) and run your app on the emulator.
  2. In the emulator panel, select Wear Health Services. Open Wear Health Services panel The Wear Health Services panel opens, showing a list of sensors that are available on different Android-powered devices.

After the panel opens, you can do the following:

  • Toggle among Standard capabilities, All capabilities (default), or Custom. Select Apply to send the current list of capabilities to the emulated device, and select Reset to restore the list of capabilities to their default on-off values.
  • Trigger different user events after you select the Trigger events drop-down button. From here, you can Trigger auto pause/resume of fitness activities, Trigger sleep events by the user, and Trigger golf shots that the user takes on a golf course or mini-golf course.
  • Override sensor values, after you begin an exercise in an app that's installed on the emulator. After you enter new values for different exercise metrics, select Apply to sync these values with the emulator. This is useful for testing how your app handles different exercise conditions and users' fitness tendencies.

Compose Preview Screenshot Testing tool

Use the Compose Preview Screenshot Testing tool to test your Compose UIs and prevent regressions. The new tool helps you generate HTML reports that let you visually detect any changes to your app's UI. Learn more at Compose Preview Screenshot Testing.

Updated Build menu and actions

We made the following changes to the build actions and the Build menu to help make it easy to build exactly what you want as you work on projects in Android Studio:

  • Added a new Build 'run-configuration-name' Run Configuration action: This action builds the currently selected run configuration. For example, if you have the :app run configuration selected, the action will build the app Run Configuration and will assemble app. If you have recently run a test on a device the action will build those tests.
  • Made Build 'run-configuration-name' Run Configuration the default Build action: To better match developer's intent, both the toolbar button and the shortcut Control/Command+F9 now execute the new Build run-configuration-name Run Configuration action.
  • Reordered build actions: We placed the new Build run-configuration-name option at the top of the Build menu. We also placed Compile actions below that and moved the "Assemble ..." actions (previous "Make ..." actions) below that.
  • Used verbs that match what the build actions actually do: In addition to "Build" and "Compile" actions, we renamed "Make Project" to "Assemble Project". We also introduced a new "Assemble Project with Tests" action to assemble test components as well.
  • De-emphasized some actions that are not frequently used: We also removed some actions from the build menu (e.g. Run Generate Sources Gradle Tasks). That action remains so you can find it through "Find Action.." (Control/Command+Shift+A). Other actions were moved to other menus. For example, "Refresh Linked C++ projects" was moved to the File menu below "Sync Project with Gradle Files".