Tag Archives: Android Studio

Android Studio uses Gemini Pro to make Android development faster and easier

Posted by Sandhya Mohan – Product Manager, Android Studio

As part of the next chapter of our Gemini era, we announced we were bringing Gemini to more products. Today we’re excited to announce that Android Studio is using the Gemini 1.0 Pro model to make Android development faster and easier, and we’ve seen significant improvements in response quality over the last several months through our internal testing. In addition, we are making this transition more apparent by announcing that Studio Bot is now called Gemini in Android Studio.

Gemini in Android Studio is an AI-powered coding assistant which can be accessed directly in the IDE. It can accelerate your ability to develop high-quality Android apps faster by helping generate code for your app, providing complex code completions, answering your questions, finding relevant resources, adding code comments and more — all without ever having to leave Android Studio. It is available in 180+ countries and territories in Android Studio Jellyfish.

If you were already using Studio Bot in the canary channel, you’ll continue experiencing the same helpful and powerful features, but you’ll notice improved quality in responses compared to earlier versions.

Ask Gemini your Android development questions

Gemini in Android Studio can understand natural language, so you can ask development questions in your own words. You can enter your questions in the chat window ranging from very simple and open-ended ones to specific problems that you need help with.

Here are some examples of the types of queries it can answer:

    • How do I add camera support to my app?
    • Using Compose, I need a login screen with the following: a username field, a password field, a 'Sign In' button, a 'Forgot Password?' link. I want the password field to obscure the input.
    • What's the best way to get location on Android?
    • I have an 'orders' table with columns like 'order_id', 'customer_id', 'product_id', 'price', and 'order_date'. Can you help me write a query that calculates the average order value per customer over the last month?
Moving image demonstrating a conversation in Android Studio

Gemini in Android Studio remembers the context of the conversation, so you can also ask follow-up questions, such as “Can you give me the code for this in Kotlin?” or “Can you show me how to do it in Compose?”

Code faster with AI powered Code Completions

Gemini in Android Studio can help you be more productive by providing you with powerful AI code completions. You can receive suggestions of multi-line code completions, suggestions for how to do comments for your code, or how to add documentation to your code.

Moving image demonstrating code completion in Android Studio

Designed with privacy in mind

Gemini in Android Studio was designed with privacy in mind. Gemini is only available after you log in and enable it. You don’t need to send your code context to take advantage of most features. By default, Gemini in Android Studio’s chat responses are purely based on conversation history, and you control whether you want to share additional context for customized responses. You can update this anytime in Android Studio > Settings at a granular project level. We also have a custom way for you to opt out certain files and folders through an .aiexclude file. Much like our work on other AI projects, we stick to a set of AI Principles that hold us accountable. Learn more here.

image of share settings in Android Studio

Build a Generative AI app using the Gemini API starter template

Not only does Android Studio use Gemini to help you be more productive, it can also help you take advantage of Gemini models to create AI-powered features in your applications. Get started in minutes using the Gemini API starter template available in the canary release – channel for Android Studio – under File > New Project > Gemini API Starter. You can also use the code sample available at File > Import Sample > Google Generative AI sample.

The Gemini API is multimodal, meaning it can support image and text inputs. For example, it can support conversational chat, summarization, translation, caption generation etc. using both text and image inputs.

image of starter templates in Android Studio

Try Gemini in Android Studio

Gemini in Android Studio is still in preview, but we have added many feature improvements — and now a major model update — since we released the experience in May 2023. It is currently no-cost for developers to try out. Now is a great time to test it and let us know what you think, before we release this experience to stable.


Stay updated on the latest by following us on LinkedIn, Medium, YouTube, or X. Let's build the future of Android apps together!

Android Studio Iguana is stable

Posted by Neville Sicard-Gregory – Senior Product Manager, Android Studio

Today we are launching Android Studio Iguana 🦎 in the stable release channel to make it easier for you to create high quality apps. With features like Version Control System support in App Quality Insights, to the new built-in support to create Baseline Profiles for Jetpack Compose apps, this version should enhance your development workflow as you optimize your app. Download the latest version today!

Check out the list of new features in Android Studio Iguana below, organized by key developer flows.

Debugging

Version control system integration in App Quality Insights

When your release build is several commits behind your local source code, line numbers in Firebase Crashlytics crash reports can easily go stale, making it more difficult to accurately navigate from crash to code when using App Quality Insights. If you’re using git for your version control, there’s now a solution to this problem.

When you build your app using Android Gradle Plugin 8.3 or later and the latest version of the Crashlytics SDK, AGP includes git commit information as part of the build artifact that is published to the Play Store. When a crash occurs, Crashlytics attaches the git information to the report, and Android Studio Iguana uses this information to compare your local checkout with the exact code that caused the crash from your git history.

After you build your app using Android Gradle Plugin 8.3 or higher with the latest Crashlytics SDK, and publish it, new crash reports in the App Quality Insights window let you either navigate to the line of code in your current git checkout or view a diff report between the current checkout and the version of your app codebase that generated the crash report. Learn more.

app quality insights with version control system integration in Android Studio
App Quality Insights with Version Control System Integration

View Crashlytics crash variants in App Quality Insights

app quality insights in Android Studio
Crash variants in App Quality Insights

Today, when you select a Crashlytics issue in App Quality Insights, you see aggregated data from events that share identical points of failure in your code, but may have different root causes. To aid in your analysis of the root causes of a crash, Crashlytics now groups events that share very similar stack traces as issue variants. You can now view events in each variant of a crash report in App Quality Insights by selecting a variant from the dropdown. Alternatively, you can view aggregate information for all variants by selecting All.

Design

Jetpack Compose UI Check

To help developers build adaptive and accessible UI in Jetpack Compose, Iguana introduces a new UI Check mode in Compose Preview. This feature works similarly to visual linting and accessibility checks integrations for views. Activate Compose UI check mode to automatically audit your Compose UI and check for adaptive and accessibility issues across different screen sizes, such as text that's stretched on large screens or low color contrast. The mode highlights issues found in different preview configurations and lists them in the problems panel.

Try it out by clicking the UI Check icon in Compose Preview.

UI Check entry point in Compose Preview
UI Check entry point in Compose Preview

UI Check results of Reply App in Compose Preview
UI Check results of Reply App in Compose Preview

Progressive rendering for Compose Preview

Compose Previews in Android Studio Iguana now implement progressive rendering, allowing you to iterate on your designs with less loading time. This feature automatically lowers the detail of out-of-view previews to boost performance, meaning you can scroll through even the most complex layouts without lag.

moving image showing progressive rendering in Compose
Progressive Rendering in Compose

Develop

Intellij Platform Update

Android Studio Iguana includes the IntelliJ 2023.2 platform release, which has many new features such as support for GitLab, text search in Search Everywhere, color customization updates to the new UI and a host of new improvements. Learn more.

Testing

Baseline Profiles module wizard

Many times when you run an Android app for the first time on a device, the app can appear to have a slow start time because the operating system has to run just-in-time compilation. To improve this situation, you can create Baseline Profiles that help Android improve aspects like app start-up time, scrolling, and navigation speed in your apps. We are simplifying the process of setting up a Baseline Profile by offering a new Baseline Profile Generator template in the new module wizard (File > New > New Module). This template configures your project to support Baseline Profiles and employs the latest Baseline Profiles Gradle plugin, which simplifies setup by automating required tasks with a single Gradle command.

Baseline Profile module wizard - Create New Module
Baseline Profile Generator

Furthermore, the template creates a run configuration that enables you to generate a Baseline Profile with a single click from the "Select Run/Debug Configuration" dropdown list.

Generate Baseline Profile drop-down menu
Generate Baseline Profile drop-down menu

Test against configuration changes with the Espresso Device API

Synchronous testing of window size changes using Espresso Device API
Synchronous testing of window size changes using Espresso Device API

Catch layout problems early and ensure your app delivers a seamless user experience across devices and orientations. The Espresso Device API simulates how your app reacts to configuration changes—such as screen rotation, device folding/unfolding, or window size changes—in a synchronous way on virtual devices. These APIs help you rigorously test and preemptively fix issues that frustrate users so you build more reliable Android apps with confidence. These APIs are built on top of new gRPC endpoints introduced in Android Emulator 34.2, which enables secure bidirectional data streaming and precise sensor simulation.

Pixel 8 and Pixel 8 Pro devices in Android Emulator (34.2)

Test your app on the latest Google Pixel device configurations with the updated Android Virtual Device definitions in Android Studio. With Android Studio Iguana and the latest Android Emulator (34.2+), access the Pixel Fold, Pixel Tablet, Pixel 7a, Pixel 8, and Pixel 8 Pro. Validating your app on these virtual devices is a convenient way to ensure that your app reacts correctly to a variety of screen sizes and device types.

New Pixel Android Virtual Devices in the Android Emulator
New Pixel Android Virtual Devices in the Android Emulator.

Build

Support for Gradle Version Catalogs

Android Studio Iguana streamlines dependency management with its enhanced support for TOML-based Gradle Version Catalogs. You'll benefit from:

    • Centralized dependency management: Keep all your project's dependencies organized in a single file for easier editing and updating.
    • Time-saving features: Enjoy seamless code completion, smart navigation within your code, and the ability to quickly edit project dependencies through the convenient Project Structure dialog.
    • Increased efficiency: Say goodbye to scattered dependencies and manual version updates. Version catalogs give you a more manageable, efficient development workflow.

New projects will automatically use version catalogs for dependency management. If you have an existing project, consider making the switch to benefit from these workflow improvements. To learn how to update to Gradle version catalogs, see Migrate your build to version catalogs.

Additional SDK insights: policy issues

Android Studio Iguana now proactively alerts you to potential Google Play policy violations through integration with the Google Play SDK Index. Easily see Play policy issues right in your build files and Project Structure Dialog. This streamlines compliance, helping you avoid unexpected publishing delays or rejections on the Google Play Store.

Android Studio's project structure dialog showing a warning from the Google Play SDK Index
A warning from the Google Play SDK Index in Android Studio’s Project Structure dialog

Android Studio compileSdk version support

Using Android Studio to develop a project that has an unsupported compileSdk version can lead to unexpected errors because older versions of Android Studio may not handle the new Android SDK correctly. To avoid these issues, Android Studio Iguana now explicitly warns you if your project’s intended compileSdk is for a newer version that it does not officially support. 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 that you upgrade AGP.

Summary

To recap, Android Studio Iguana 🦎includes the following enhancements and features:

Debugging

Design

Develop

    • Intellij platform update

Testing

Build

Download Android Studio Today

Download Android Studio Iguana 🦎 today and take advantage of the latest features to streamline your workflow and help you make better apps. Your feedback is essential – check known issues, report bugs, suggest improvements, and be part of our vibrant community on LinkedIn Medium, YouTube, or X (formerly known as Twitter). Let's build the future of Android apps together!

Android Studio Hedgehog is stable

Posted by Sandhya Mohan, Product Manager

Today, we are thrilled to announce the stable release of Android Studio Hedgehog 🦔 : The official IDE for building Android apps!

In this Android Studio release, we have upgraded the IntelliJ platform to 2023.1, with features designed to improve app performance and battery life, make it easier to upgrade applications to the latest Android version, and make it faster to develop using Jetpack Compose. Read on to learn more about how Android Studio Hedgehog can help supercharge your developer productivity.

App performance

Android vitals in App Quality Insights

In addition to helping you investigate crash reports for apps instrumented with the Firebase Crashlytics SDK, App Quality Insights now also includes Android vitals data from Google Play Console. With Android vitals, you can see crash reports for any app you publish to the Google Play Store without requiring additional instrumentation in your app. You can view Android vitals issues, filter them, and see crash insights from Play to quickly understand and resolve the cause of a crash, and jump from stack trace to code all from the App Quality Insights tool window. Learn more.

Note: If you don't have permission to view your app in the Play Console, request that the app admin share read-only access to only app quality information, by clicking Users and permissions > View app quality information (read-only) in the Play Console.

Screengrab of Android Vitals data in App Quality Insights
Android Vitals data in App Quality Insights

Power Profiler

The new Power Profiler shows power consumption on devices. It segments the power consumption information by subsystems called "Power Rails". This helps you visualize the correlation between power consumed and the actions occurring in your app. This approach of directly measuring power consumption differs from the legacy Energy Profiler, which only used a model to estimate energy consumption.

By understanding this information, you can potentially identify and fix power consumption issues in your app by running A/B tests to compare the power consumption of different algorithms, features or even different versions of your app.

Apps which are optimized for lower power consumption lead to an improved battery and thermal performance, eventually leading to an improved end user experience. Power Rails data is available on Pixel 6+ devices running Android 10+.

Example of power consumption in different power rails.
Example of power consumption in different power rails.

Coding productivity

Target Android 14 using Android SDK Upgrade Assistant

The SDK Upgrade Assistant provides a step by step wizard flow to help developers through targetSdkVersion upgrades. It pulls documentation directly into the IDE, saving you time and effort.

Android Studio Hedgehog adds support for upgrading projects to Android 14 (API Level 34). We’ve also added additional relevance filters so that unnecessary steps are removed — and in some cases, the upgrade assistant will pinpoint exactly where in code the changes need to be made.

Screengrab of Android SDK Upgrade Assistant
Android SDK Upgrade Assistant

New UI updates

In the Giraffe release, we launched a new UI for the IDE. This reimagined theme reduces visual complexity and provides easier access to essential features, resulting in a more modern and clean look and feel. We’ve listened to your feedback and, in Hedgehog, we’ve added updates for compact mode, vertical and horizontal splitting, and project tabs for Mac OS. If you have not yet tried the new UI, we encourage you to do so.

Screengrab of Compact mode in the New UI
Compact mode in the New UI

Device mirroring

You can now mirror your physical Android device in the Running Devices window in Android Studio. While mirroring your device's display directly via ADB over USB or Wi-FI to Android Studio, you can execute common actions such as starting and interacting with apps, rotating the screen, folding and unfolding the phone, changing the volume, and more – directly from within Android Studio. Learn more.

Moving image demonstrating device mirroring in the running devices window
Device Mirroring in the Running Devices window

Embedded Layout Inspector

You now have the option to run the Layout Inspector directly in the Running Devices tool window while running your app on an embedded virtual device or mirrored physical device. This opt-in feature significantly improves performance of Layout Inspector, conserves screen real estate, helps organize your UI debugging workflow in a single tool window, and improves speed while inspecting your layout. In embedded mode, you can show a view hierarchy, inspect the properties of each view, navigate to code using “deep inspect” mode, and access other common Layout Inspector features. Enable it through Settings > Experimental > Layout Inspector

Screengrab showing Embedded Layout Inspector
Embedded Layout Inspector

Live Edit updated manual mode shortcut

Live Edit has a new default shortcut for manual mode for: Control+\ (Command+\ for macOS). Manual mode is helpful in situations where you want to have precise control over when updates are deployed to the running application. For more information, see the video clip in Live Edit for Jetpack Compose.

Compose tools

Compose Preview’s Gallery Mode

Gallery mode is a new mode in Compose Preview that lets you focus on one Preview at a time to conserve rendering resources. Use Gallery mode when iterating on UI and switch to other modes (Grid or List) when you need to see UI variants.

Moving image of Compose Preview's Gallery Mode
Compose Preview’s Gallery Mode

Compose State information in Debugger

When setting a breakpoint on a Composable function, the debugger now lists the parameters of the composable and their state, so you can more easily identify what changes might have caused unexpected recompositions.

Screengrab of Compose State information in Debugger
Compose State information in Debugger

Compose Multipreview templates

Android Studio Hedgehog includes support for the latest annotations added by the Compose Multipreview API, allowing developers to render common layout scenarios side-by-side while working with the Compose Preview.

The new annotations added include: @PreviewScreenSizes, @PreviewFontScales, @PreviewLightDark, and @PreviewDynamicColors

Screengrab of Compose Multipreview templates
Compose Multipreview templates

Build tools

New macro to specify JDK path

A new macro, #GRADLE_LOCAL_JAVA_HOME, makes it safer and easier to specify the Java* home path used for the Gradle daemon (background process) execution for your project by referencing your .gradle/config.properties file. This reduces errors related to incompatible Gradle and project JDK versions, since there is now a single source of truth for your Gradle JDK selection.

Starting with Android Studio Hedgehog, new projects will use #GRADLE_LOCAL_JAVA_HOME by default. Existing projects will automatically be migrated to the new macro after a successful sync, unless you're already using a macro like #JAVA_HOME.

[Windows-only] Minimize the impact of antivirus software on build speed

The Build Analyzer informs users if antivirus software may be impacting build performance. This can occur if antivirus software, such as Windows Defender, is performing real-time scanning of directories used by Gradle. Build Analyzer recommends a list of directories to exclude from active scanning, and, if possible, provides a link to add them to the Windows Defender folder exclusion list.

Use Firebase Test Lab devices with Gradle Managed Devices

Gradle Managed Devices can now target Firebase Test Lab devices, and you can utilize it to run your automated tests at scale. Use Gradle Managed Devices to select from a wide range range of both physical and virtual FTL devices, with support for test sharding for accelerated execution time. To use FTL devices, you need Android Gradle Plugin 8.2 with the latest Alpha version of the Firebase Test Lab Gradle plugin. Learn more.

Download Android Studio today!

Now is the time to download Android Studio Hedgehog to incorporate the new features into your workflow. As always, we appreciate any feedback on things you like, issues, or features you would like to see. If you find an issue, please check the known issues and file a bug if needed. Remember to also follow us on X (formerly known as Twitter), Medium, or YouTube for more Android development updates!


*Java is a trademark or registered trademark of Oracle and/or its affiliates.

Studio Bot expands to 170+ international markets!

Posted by Isabella Fiterman – Product Marketing Manager, and Sandhya Mohan – Product Manager

At this year’s Google I/O, one of the most exciting announcements for Android developers was the introduction of Studio Bot, an AI-powered coding assistant which can be accessed directly in Android Studio. Studio Bot can accelerate your ability to write high-quality Android apps faster by helping generate code for your app, answering your questions, finding relevant resources— all without ever having to leave Android Studio. After our announcement you told us how excited you were about this AI-powered coding companion, and those of you outside of the U.S were eager to get your hands on it. We heard your feedback, and expanded Studio Bot to over 170 countries and territories in the canary release channel of Android Studio.

Ask Studio Bot your Android development questions

Studio Bot is powered by artificial intelligence and can understand natural language, so you can ask development questions in your own words. While it’s now available in most countries, it is designed to be used in English. You can enter your questions in Studio Bot’s chat window ranging from very simple and open-ended ones to specific problems that you need help with. Here are some examples of the types of queries it can answer:

How do I add camera support to my app?


I want to create a Room database.

Can you remind me of the format for javadocs?

What's the best way to get location on Android?

Studio Bot remembers the context of the conversation, so you can also ask follow-up questions, such as “Can you give me the code for this in Kotlin?” or “Can you show me how to do it in Compose?”


Moving image showing a user having conversation with Studio Bot

Designed with privacy in mind

Studio Bot was designed with privacy in mind. You don’t need to send your source code to take advantage of Studio Bot’s features. By default, Studio Bot’s responses are purely based on conversation history, and you control whether you want to share additional context or code for customized responses. Much like our work on other AI projects, we stick to a set of AI Principles that hold us accountable.

Focus on quality

Studio Bot is still in its early days, and we suggest validating its responses before using them in a production app. We’re continuing to improve its Android development knowledge base and quality of responses so that it can better support your development needs in the future. You can help us improve Studio Bot by trying it out and sharing your feedback on its responses using the thumbs up and down buttons.

Try it out!

Download the latest canary release of Android Studio and read more about how you can get started with Studio Bot. You can also sign up to receive updates on Studio Bot as the experience evolves.

What’s new in the Jetpack Compose August ’23 release

Posted by Ben Trengrove, Android Developer Relations Engineer

Today, as part of the Compose August ‘23 Bill of Materials, we’re releasing version 1.5 of Jetpack Compose, Android's modern, native UI toolkit that is used by apps such as Play Store, Dropbox, and Airbnb. This release largely focuses on performance improvements, as major parts of our modifier refactor we began in the October ‘22 release are now merged.

Performance

When we first released Compose 1.0 in 2021, we were focused on getting the API surface right to provide a solid foundation to build on. We wanted a powerful and expressive API that was easy to use and stable so that developers could confidently use it in production. As we continue to improve the API, performance is our top priority, and in the August ‘23 release, we have landed many performance improvements.

Modifier performance

Modifiers see large performance improvements, up to 80% improvement to composition time, in this release. The best part is that, thanks to our work getting the API surface right in the first release, most apps will see these benefits just by upgrading to the August ‘23 release.

We have a suite of benchmarks that are used to monitor for regressions and to inform our investments in improving performance. After the initial 1.0 release of Compose, we began focusing on where we could make improvements. The benchmarks showed that we were spending more time than anticipated materializing modifiers. Modifiers make up the vast majority of a composition tree and, as such, were the largest contributor to initial composition time in Compose. Refactoring modifiers to a more efficient design began under the hood in the October ‘22 release.

The October ‘22 release included new APIs and performance improvements in our lowest level module, Compose UI. Modifiers build on top of each other so we started migrating our low level modifiers in Compose Foundation in the next release, March ‘23. This included graphicsLayer, low level focus modifiers, padding, and offset. These low level modifiers are used by other highly utilized modifiers such as Clickable, and are also utilized by many framework Composables such as Text. Migrating modifiers in the March ‘23 release brought performance improvements to those components, but the real gains would come when we could migrate the higher level modifiers and composables themselves to the new modifier system.

In the August ‘23 release, we have begun migrating the Clickable modifier to the new modifier system, bringing substantial improvements to composition time, in some cases up to 80%. This is especially relevant in lazy lists that contain clickable elements such as buttons. Modifier.indication, used by Clickable, is still in the process of being migrated, so we anticipate further gains to come in future releases.

As part of this work, we identified a use case for composed modifiers that wasn’t covered in the original refactor and added a new API to create Modifier.Node elements that consume CompositionLocal instances.

We are now working on documentation to guide you through migrating your own modifiers to the new Modifier.Node API. To get started right away, you can reference the samples in our repository.

Learn more about the rationale behind the changes in the Compose Modifiers deep dive talk from Android Dev Summit ‘22.

Memory

This release includes a number of improvements in memory usage. We have taken a hard look at allocations happening across different Compose APIs and have reduced the total allocations in a number of areas, especially in the graphics stack and vector resource loading. This not only reduces the memory footprint of Compose, but also directly improves performance, as we spend less time allocating memory and reduce garbage collection.

In addition, we fixed a memory leak when using ComposeView, which will benefit all apps but especially those that use multi-activity architecture or large amounts of View/Compose interop.

Text

BasicText has moved to a new rendering system backed by the modifier work, which has brought an average of gain of 22% to initial composition time and up to a 70% gain in one benchmark of complex layouts involving text.

A number of Text APIs have also been stabilized, including:

Improvements and fixes for core features

We have also shipped new features and improvements in our core APIs as well as stabilizing some APIs:

  • LazyStaggeredGrid is now stable.
  • Added asComposePaint API to replace toComposePaint as the returned object wraps the original android.graphics.Paint.
  • Added IntermediateMeasurePolicy to support lookahead in SubcomposeLayout.
  • Added onInterceptKeyBeforeSoftKeyboard modifier to intercept key events before the soft keyboard.

Get started!

We’re grateful for all of the bug reports and feature requests submitted to our issue tracker — they help us to improve Compose and build the APIs you need. Continue providing your feedback, and help us make Compose better!

Wondering what’s next? Check out our roadmap to see the features we’re currently thinking about and working on. We can’t wait to see what you build next!

Happy composing!

Deep dive into Live Edit for Jetpack Compose UI

Posted by Alan Leung, Staff Software Engineer, Fabien Sanglard, Senior Software Engineer, Juan Sebastian Oviedo, Senior Product Manager
A closeup look into how the Android Studio team built Live Edit; a feature that accelerates the Compose development process by continuously updating the running application as code changes are made.

What’s Live Edit and how can it help me?

Live Edit introduces a new way to edit your app’s Jetpack Compose UI by instantly deploying code changes to the running application on a physical device or emulator. This means that you can make changes to your app’s UI and immediately see their effect on the running application, enabling you to iterate faster and be more productive in your development. Live Edit was recently released to the stable channel with Android Studio Giraffe and can be enabled in the Editor settings. Developers like Plex and Pocket Casts are already using Live Edit and it has accelerated their development process for Compose UI. It is also helping them in the process of migrating from XML views to Compose.


Moving image illustrating Live Edit in action on Android Studio Hedgehog
Live Edit in action on Android Studio Hedgehog

When should I use Live Edit?

Live Edit is a different feature from Compose Preview and Apply Changes. These features provide value in different ways:

Feature

Description

When should I use it?

Live Edit[Kotlin only, supports live recomposition] Make changes to your Compose app’s UI and immediately see their effect on the running application on an emulator or physical device. Quickly see the effect of updates to UX elements (such as modifier updates and animations) on the overall app experience while the application is running.
Compose Preview

[Compose only] Visualize Compose elements in the Design tab within Android Studio and see them automatically refresh as you make code changes. Preview individual Compose elements in one or many different configurations and states, such as dark theme, locales, and font scale.
Apply Changes

Deploy code and resource updates to a running app without restarting it—and, in some cases, without restarting the current activity. Update code and resources in a non-Compose app without having to redeploy it to an emulator or physical device.

How does it work?

At a high level, Live Edit does the following:

  1. Detects source code changes.
  2. Compiles classes that were updated.
  3. Pushes new classes to the device.
  4. Adds a hook in each class method bytecode to redirect calls to the new bytecode.
  5. Edits the app classpath to ensure changes persist even if the app is restarted.

Illustration of Live Edit architechture
Live Edit architecture

Keystroke detection

This step is handled via the Intellij IDEA Program Structure Interface (PSI) tree. Listeners allow LE to detect the moment a developer makes a change in the Android Studio editor.

Compilation

Fundamentally, Live Edit still relies on the Kotlin compiler to generate code for each incremental change.

Our goal was to create a system where there is less than 250ms latency between the last keystroke and the moment the recomposition happens on the device. Doing a typical incremental build or invoking an external compiler in a traditional sense would not achieve our performance requirement. Instead, Live Edit leverages Android Studio’s tight integration with the Kotlin compiler.

On the highest level, the Kotlin compiler’s compilation can be divided into two stages.

  • Analysis
  • Code generation

The analysis performed as the first step is not entirely restricted to a build process. In fact, the same step is frequently done outside the build system as part of an IDE. From basic syntax checking to auto-complete suggestions, the IDE is constantly performing the same analysis (Step 1 of Diagram 1) and caching the result to provide Kotlin- and Compose-specific functionality to the developer. Our experiment shows that the majority of the compilation time is spent in the analysis stage during build. Live Edit uses that information to invoke the Compose compiler. This allows compilation to happen within 200ms using typical laptops used by developers. Live Edit further optimizes the code generation process and focuses solely on generating code that is only necessary to update the application.

The result is a plain .class file (not a .dex file) that is passed to the next step in the pipeline, desugaring.

How to desugar

When Android app source code is processed by the build system, it is usually “desugared” after it is compiled. This transformation step lets an app run on a set of Android versions devoid of syntactic sugar support and recent API features. This allows developers to use new APIs in their app while still making it available to devices that run older versions of Android.

There are two kinds of desugaring, known as language desugaring and library desugaring. Both of these transformations are performed by R8. To make sure the injected bytecode will match what is currently running on the device, Live Edit must make sure each class file is desugared in a way that is compatible with the desugaring done by the build system.

Language desugaring:

This type of bytecode rewrite aims to provide newer language features for lower targeted API level devices. The goal is to support language features such as the default interface method, lambda expression, method reference, and so on, allowing support down to the min API level. This value is extracted from the .apk file's DEX files using markers left in there by R8.

API desugaring:

Also known as library desugaring, this form of desugaring aims to support JAVA SDK methods and classes. This is configured by a JSON file. Among other things, method call sites are rewritten to target functions located in the desugar library (which is also embedded in the app, in a DEX file). To perform this step, Gradle collaborates with Live Edit by providing the JSON file used during library desugaring.

Function trampoline

To facilitate a rapid “per-key-stroke” speed update to a running application, we decided to not constantly utilize the JVMTI codeswap ability of the Android Runtime (ART) for every single edit. Instead, JVMTI is only used once to perform a code swap that installs trampolines onto a subset of methods within the soon-to-be modified classes inside the VMs. Utilizing something we called the “Primer” (Step 3 of Diagram 1), invocation of the methods is redirected to a specialized interpreter. When the application no longer sees updates for a period of time, Live Edit will replace the code with traditional DEX code for performance benefits of ART. This saves developers time by immediately updating the running application as code changes are made.

Illustration of Function trampoline process
Function trampoline process

How code is interpreted

Live Edit compiles code on the fly. The resulting .class files are pushed, trampolined (as previously described), and then interpreted on the device. This interpretation is performed by the LiveEditInterpreter. The interpreter is not a full VM inside ART. It is a Frame interpreter built on top of ASM Frame. ASM Frame handles the low level logistics such as the stack/local variables's push/load, but it needs an Interpreter to actually execute opcode. This is what the OpcodeInterpreter is for.

Flow chart of Live Edit interpretation
Live Edit interpretation flow

Live Edit Interpreter is a simple loop which drives ASM/Interpreter opcodes interpretation.

Some JVM instructions cannot be implemented using a pure Java interpreter (in particular invokeSpecial and monitorEnter/Exit are problematic). For these, Live Edit uses JNI.

Dealing with lambdas

Lambdas are handled in a different manner because changes to lambda captures can result in changes in VM classes that are different in many method signatures. Instead, new lambda-related updates are sent to the running device and loaded as new classes instead of redefining any existing loaded classes as described in the previous section.

How does recomposition work?

Developers wanted a seamless and frictionless new approach to program Android applications. A key part of the Live Edit experience is the ability to see the application updated while the developer continuously writes code, without having to explicitly trigger a re-run with a button press. We needed a UI framework that has the ability to listen to model changes within the application and perform optimal redraws accordingly. Luckily, Jetpack Compose fits this task perfectly. With Live Edit, we added an extra dimension to the reactive programming paradigm where the framework also observes changes to the functions’ code.

To facilitate code modification monitoring, the Jetpack Compose compiler supplies Android Studio with a mapping of function elements to a set of recomposition group keys. The attached JVMTI agent invalidates the Compose state of a changed function in an asynchronous manner and the Compose runtime performs recomposition on Composables that are invalidated.

How we handle runtime errors during recomposition

Moving image of Live edit handling a runtime error
Live Edit handling a runtime error

While the concept of a continuously updating application is rather exhilarating, our field studies showed that sometimes when developers are writing code, the program can be in an incomplete state where updating and re-executing certain functions would lead to undesirable results. Besides the automatic mode where updates are happening almost continuously, we have introduced two manual modes for the developer who wants a bit more control on when the application gets updated after new code is detected.

Even with that in mind, we want to make sure common issues caused by executing incomplete functions do not cause the application to terminate prematurely. Cases where a loop’s exit condition is still being written are detected by Live Edit to avoid an infinite loop within the program. Also, if a Live Edit update triggers recomposition and causes a runtime exception to be thrown, the Compose runtime will catch such an exception and recompose using the last known good state.

Consider the following piece of code:

var x = y / 10

Suppose the developer would like to change 10 to 50 by deleting the character 1 and inserting character 5 after. Android Studio could potentially update the application before the 5 is inserted and thus create a division-by-zero ArithmeticException. However, with the added error handling mentioned, the application would simply revert to “y / 10” until further updates are done in the editor.

What’s coming?

The Android Studio team believes Live Edit will change how UI code is written in a positive way and we are committed to continuously improve the Live Edit development experience. We are working on expanding the types of edits developers can perform. Furthermore, future versions of Live Edit will eliminate the need to invalidate the whole application during certain scenarios.

Additionally, PSI event detection comes with limitations such as when the user edits import statements. To solve this problem, future versions of Live Edit will rely on .class diffing to detect changes. Lastly, the full persisting functionality isn't currently available. Future versions of Live Edit will allow the application to be restarted outside of Android Studio and retain the Live Edit changes.

Get started with Live Edit

Live Edit is ready to be used in production and we hope it can greatly improve your experience developing for Android, especially for UI-heavy iterations. We would love to hear more about your interesting use cases, best practices and bug reports and suggestions.

Java is a trademark or registered trademark of Oracle and/or its affiliates.

Android Studio Giraffe is stable

Posted by Mayank Jain, Product Manager

Today, we are thrilled to announce the stable release of Android Studio Giraffe 🦒 : The official IDE for building Android apps!

In this Android Studio release, we have upgraded the IntelliJ platform to 2022.3, including a brand new visual look and feel in Android Studio, improvements to Live Edit, Compose animation previews, a new Device Explorer, a new SDK upgrade assistant, ability to use Kotlin DSL in your Gradle build scripts and much more. Read on to learn more about how Android Studio Giraffe 🦒 can help supercharge your developer productivity.

Thank you to all of you who have given us feedback and used Android Studio since we launched our initial version just over 10 years ago. Download the latest stable version today and we look forward to continuing to deliver on our commitment of delivering a best-in-class integrated development environment (IDE) focused on Android app development!

IDE Enhancements

New UI for Android Studio (Preview) 
Along with the much anticipated IntelliJ Platform update, we are excited to share a preview of the visual look that we call the “New UI” for Android Studio Giraffe. The redesigned theme aims to reduce visual complexity, provide easier access to essential features, and disclose complex functionality as needed—resulting in a modern, cleaner look and feel.

The New UI was first released as an early preview in IntelliJ 2022.2 to gather feedback from users and other IntelliJ-based IDEs to ensure it could fully replace the previous UI. Since then, it’s progressed to beta in IntelliJ 2022.3, with many bug fixes and improvements.

With the Giraffe release, we’ve started adopting the new UI, with several Android Studio specific changes, such as optimizing the default main toolbar and tool windows configurations for Android and refreshing our iconography in the style. We are excited by this new design direction and will continue adoption through the Hedgehog release and onward.

To use the New UI, enable it in Settings > Appearance & Behavior > New UI. For a full list of changes, see the IntelliJ New UI documentation.

Image showing the new UI adopted from IntelliJ
The New UI adopted from IntelliJ
New diagnostic & bug reporting tool 
As you try the New UI, please provide us detailed feedback through our new diagnostic & bug reporting tool that makes it easier to report bugs with relevant log files already attached. The new bug reporting tool is found at Help > Collect Logs and Diagnostic Data.

Image showing the new diagnostic & bug reporting tool
New diagnostic & bug reporting tool
Updated Device Explorer 
Also shipping with the new UI, is an updated Device Explorer (known as the Device File Explorer in previous versions of Android Studio). In the Device Explorer, files and related actions are located in the Files tab. Additionally, in the new Processes tab, you can view a list of debuggable processes for the connected device. From there you can also select a process and perform a kill , force-stop, or attach the debugger to a given process.

Image showing a screen capture of the updated device explorer
Updated Device Explorer

Coding Productivity

Use Live Edit to update composables in real time 
Live Edit lets you update composables in Android emulators and physical devices in near real time. You can now edit composables and see the UI changes on the running device without re-deploying your app.

This helps you by minimizing the context switching between writing and building your app, letting you focus on writing code longer without interruption. To try Live Edit, enable it via Settings > Editor > Live Edit and use Android Gradle Plugin (AGP) 8.1 or higher and Jetpack Compose Runtime 1.3.0 or higher.

Moving image illustrating updating composables in real time in Live Edit
Use Live Edit to update composables in real time
 
Compose Animation Preview - Extend animation support  Compose Animation Preview now supports a number of additional Compose APIs, such as animate*AsState, CrossFade, rememberInfiniteTransition, and AnimatedContent (in addition to updateTransition and AnimatedVisibility). Additionally, now there are new pickers that let you set non-enum or boolean states to debug your Compose animation using precise inputs. For all supported Compose Animation APIs, you can play, pause, scrub & control speed.

Moving image illustrating extended animation support in Compose Animation Preview
Compose Animation Preview - Extend animation support
 
Android SDK Upgrade Assistant 
The new Android SDK upgrade assistant lets you see the steps required to upgrade the targetSdkVersion, or the API level that your app targets, directly in the IDE. It also pulls upgrade-related documentation directly from the Android Developer site into its tool window, so you don't have to jump back and forth between your browser and the IDE. For each migration step, it highlights the major breaking changes and how to address them, and even filters the full list of changes to only show steps relevant to your app.

To open the Android SDK Upgrade Assistant, go to Tools > Android SDK Upgrade Assistant.

Image of Android SDK Upgrade Assistant
Android SDK Upgrade Assistant

Improvements to the build system

Kotlin DSL in your Gradle build scripts 
Kotlin is not only more readable, it also offers better compile-time checking and IDE support. With Android Studio Giraffe, we are excited to offer the official support for Kotlin DSL in your Gradle build scripts. This means that Kotlin is the default language used in your project code, including UI with Jetpack Compose, and now editing the build scripts too!

Now, when you are creating new projects or modules starting from Android Studio Giraffe, you get the Kotlin DSL by default. And if you want to migrate existing builds, check out the Kotlin DSL migration guide.

We've been working with the Gradle and JetBrains teams on this improvement, and you can read more in their related announcements: Gradle Blog; JetBrains Blog.

Additionally, we’ve also added experimental 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 integrations with the Project Structure dialog, plus the New Project Wizard.

Image of Android SDK Upgrade Assistant
Kotlin DSL in your Gradle build scripts

Download info during Gradle sync
 
If you’ve ever wondered if any unexpected dependency downloads are negatively impacting your sync performance, the new Sync tool window now includes a summary of time spent downloading dependencies, and a detailed view of downloads per repository. This view updates live as sync takes place. It can even help you identify inefficiencies in how you configure your repositories.

Moving image showing download info during gradle sync
Download info during Gradle sync

Automatic per-app language support 
Typically, multilingual users set their system language to one language—such as English—but they want to select other languages for specific apps, such as Dutch, Chinese, or Hindi. Android 13 introduced support for per-app language preferences, and now Android Gradle plugin 8.1 and higher can configure your app to support it automatically based on your project’s resources. Learn more.

Make selected modules toolbar button 
With Android Studio Giraffe, you can now build only the current module you're working on by selecting the Make Selected Modules build option in the toolbar. This new option lets you check that the code you just wrote compiles without building more than needed. Learn more.

Image of Android SDK Upgrade Assistant
Kotlin DSL in your Gradle build scripts

Summary

To recap, Android Studio Giraffe includes these new enhancements and features. You can always learn more with our detailed release notes.

IDE Enhancements
  • Upgraded to IntelliJ Platform 2022.3 : Includes a number of features and bug fixes
  • New UI for Android Studio : Android Studio now adopts a number of improvements from the IntelliJ's modern design language
  • Updated Device Explorer : Offers two new tabs : Files & Processes from where you can view a list of debuggable processes, perform a kill, force-stop, or attach the debugger
  • New diagnostic & bug reporting tool : Easier to report bugs for Android Studio with relevant log files already attached
Coding Productivity
  • Use Live Edit to update composables in real time : Update composables in real time, edit composables and see the UI changes on the running device without re-deploying your app
  • Compose Animation Preview - Extend animation support : Now supports a number of additional Compose APIs and new pickers that let you set non-enum or boolean states to debug your Compose animation using precise inputs
  • Android SDK Upgrade Assistant : Now lets you see the steps required to upgrade the targetSdkVersion, or the API level that your app targets directly in Studio
Improvements to the build system
  • Kotlin DSL in your Gradle build scripts : With official support for Kotlin DSL in your Gradle build scripts, Kotlin is now the single default language for project code, UI with Jetpack Compose, and now for build scripts
  • Download info during Gradle sync : Shows a summary of time spent downloading dependencies and a detailed view of downloads per repository
  • Automatic per-app language support : AGP can now automatically configure per-app language preferences
  • Make selected modules toolbar button : build only the current module you're working on by selecting the Make Selected Modules build option in the toolbar

Download Android Studio Today!

Now is the time to download Android Studio Giraffe 🦒 to incorporate the new features into your workflow. As always, we appreciate any feedback on things you like and issues or features you would like to see. If you find a bug or issue, please file an issue and also check out known issues. Remember to also follow us on Twitter, Medium, or YouTube for more Android development updates!

What’s new in Jetpack Compose

Posted by Jolanda Verhoef, Android Developer Relations Engineer

It has been almost two years since we launched the first stable version of Jetpack Compose, and since then, we’ve seen its adoption and feature set grow spectacularly. Whether you write an application for smartphones, foldables, tablets, ChromeOS devices, smartwatches, or TVs, Compose has got you covered! We recommend you to use Compose for all new Wear OS, phone and large-screen apps. With new tooling and library features, extended Material Design 3, large screen, and Wear OS support, and alpha versions of Compose for homescreen widgets and TV… This is an exciting time!

Compose in the community

In the last year, we’ve seen many companies investigating and choosing Compose to build new features and migrate screens in their production applications. 24% of the top 1000 apps on Google Play have already chosen to adopt Compose! For example, Dropbox engineers told us that they rewrote their search experience in Compose in just a few weeks, which was 40% less time than anticipated, and less than half the time it took the team to build the feature on iOS. They also shared that they were interested in adopting Compose “because of its first-class support for design systems and tooling support”. Our Google Drive team cut their development time nearly in half when using Compose combined with architecture improvements.

It’s great to see how these teams experience faster development cycles, and also feel their UI code is more testable. Inspired? Start by reading our guide How to Adopt Compose for your Team, which outlines how and where to start, and shows the areas of development where Compose can bring huge added value.


Library features & development

Since we released the first Compose Bill of Materials in October last year, we’ve been working on new features, bug fixes, performance improvements, and bringing Compose to everywhere you build UI: phones, tablets, foldables, watches, TV, and your home screen. You can find all changes in the May 2023 release and the latest alpha versions of the Compose libraries.

We’ve heard from you that performance is something you care about, and that it’s not always clear how to create performant Compose applications. We’re continuously improving the performance of Compose. For example, as of last October, we started migrating modifiers to a new and more efficient system, and we’re starting to see the results of that migration. For text alone, this work resulted in an average 22% performance gain that can be seen in the latest alpha release, and these improvements apply across the board. To get these benefits in your app, all you have to do is update your Compose version!

Text and TextField got many upgrades in the past months. Next to the performance improvements we already mentioned, Compose now supports the latest emoji version 🫶 and includes new text features such as outlining text, hyphenation support, and configuring line breaking behavior. Read more in the release notes of the compose-foundation and compose-ui libraries.

The new pager component allows you to horizontally or vertically flip through content, which is similar to ViewPager2 in Views. It allows deep customization options, making it possible to create visually stunning effects:

Moving image showing Hoizontal Pager composable
Choose a song using the HorizontalPager composable. Learn how to implement this and other fancy effects in Rebecca Franks' blog post.

The new flow layouts FlowRow and FlowColumn make it easy to arrange content in a vertical or horizontal flow, much like lines of text in a paragraph. They also enable dynamic sizing using weights to distribute the items across the container.

Image of search filters in a real estate app created with flow layouts
Using flow layouts to show the search filters in a real estate app

To learn more about the new features, performance improvements, and bug fixes, see the release notes of the latest stable and newest alpha release of the Compose libraries.

Tools

Developing your app using Jetpack Compose is much easier with the new and improved tools around it. We added tons of new features to Android Studio to improve your workflow and efficiency. Here are some highlights:

Android Studio Flamingo is the latest stable release, bringing you:

  • Project templates that use Compose and Material 3 by default, reflecting our recommended practices.
  • Material You dynamic colors in Compose previews to quickly see how your composable responds to differently colored wallpapers on a user device.
  • Compose functions in system traces when you use the System Trace profiler to help you understand which Compose functions are being recomposed.

Android Studio Giraffe is the latest beta release, containing features such as:

  • Live Edit, allowing you to quickly iterate on your code on emulator or physical device without rebuilding or redeploying your app.
  • Support for new animations APIs in Animation preview so you can debug any animations using animate*AsStateCrossFaderememberInfiniteTransition, and AnimatedContent.
  • Compose Preview now supports live updates across multiple files, for example, if you make a change in your Theme.kt file, you can see all Previews updates automatically in your UI files.
  • Improving auto-complete behavior. For example, we now show icon previews when you’re adding Material icons, and we keep the @Composable annotation when running “Implement Members".

Android Studio Hedgehog contains canary features such as:

  • Showing Compose state information in the debugger. While debugging your app, the debugger will tell you exactly which parameters have “Changed” or have remained “Unchanged”, so you can more efficiently investigate the cause of the recomposition.
  • You can try out the new Studio Bot, an experimental AI powered conversational experience in Android Studio to help you generate code, fix issues, and learn about best practices, including all things Compose. This is an early experiment, but we would love for you to give it a try!
  • Emulator support for the newly announced Pixel Fold and Tablet Virtual Devices, so that you can test your Compose app before these devices launch later this year.
  • A new Espresso Device API that lets you apply rotation changes, folds, and other synchronous configuration changes to your virtual devices under test.

We’re also actively working on visual linting and accessibility checks for previews so you can automatically audit your Compose UI and check for issues across different screen sizes, and on multipreview templates to help you quickly add common sets of previews.

Material 3

Material 3 is the recommended design system for Android apps, and the latest 1.1 stable release adds a lot of great new features. We added new components like bottom sheets, date and time pickers, search bars, tooltips, and others. We also graduated many of the core components to stable, added more motion and interaction support, and included edge-to-edge support in many components. Watch this video to learn how to implement Material You in your app:


Extending Compose to more surfaces

We want Compose to be the programming model for UI wherever you run Android. This means including first-class support for large screens such as foldables and tablets and publishing libraries that make it possible to use Compose to write your homescreen widgets, smartwatch apps, and TV applications.

Large screen support

We’ve continued our efforts to make development for large screens easy when you use Compose. The pager and flow layouts that we released are common patterns on large screen devices. In addition, we added a new Compose library that lets you observe the device’s window size class so you can easily build adaptive UI.

When attaching a mouse to an Android device, Compose now correctly changes the mouse cursor to a caret when you hover the cursor over text fields or selectable text. This helps the user to understand what elements on screen they can interact with.

Moving image of Compose adjusting the mouse cursor to a caret when the mouse is hovering over text field

Glance

Today we publish the first beta version of the Jetpack Glance library! Glance lets you develop widgets optimized for Android phone, tablet, and foldable homescreens using Jetpack Compose. The library gives you the latest Android widget improvements out of the box, using Kotlin and Compose:

  • Glance simplifies the implementation of interactive widgets, so you can showcase your app’s top features, right on a user’s home screen.
  • Glance makes it easy to build responsive widgets that look great across form factors.
  • Glance enables faster UI Iteration with your designers, ensuring a high quality user experience.
Image of search filters in a real estate app created with flow layouts

Wear OS

We launched Compose for Wear OS 1.1 stable last December, and we’re working hard on the new 1.2 release which is currently in alpha. Here’s some of the highlights of the continuous improvements and new features that we are bringing to your wrist:

  • The placeholder and placeholderShimmer add elegant loading animations that can be used on chips and cards while content is loading.
  • expandableItems make it possible to fold long lists or long text, and only expand to show their full length upon user interaction.
  • Rotary input enhancements available in Horologist add intuitive snap and fling behaviors when a user is navigating lists with rotary input.
  • Android Studio now lets you preview multiple watch screen and text sizes while building a Compose app. Use the Annotations that we have added here.

Compose for TV

You can now build pixel perfect living room experiences with the alpha release of Compose for TV! With the new AndroidX TV library, you can apply all of the benefits of Compose to the unique requirements for Android TV. We worked closely with the community to build an intuitive API with powerful capabilities. Engineers from Soundcloud shared with us that “thanks to Compose for TV, we are able to reuse components and move much faster than the old Leanback View APIs would have ever allowed us to.” And Plex shared that “TV focus and scrolling support on Compose has greatly improved our developer productivity and app performance.”

Compose for TV comes with a variety of components such as ImmersiveList and Carousel that are specifically optimized for the living room experience. With just a few lines of code, you can create great TV UIs.

Moving image of TVLazyGrid on a screen

TvLazyColumn {   items(contentList) { content ->     TvLazyRow { items(content) { cardItem -> Card(cardItem) }   } }

Learn more about the release in this blog post, check out the “What’s new with TV and intro to Compose” talk, or see the TV documentation!

Compose support in other libraries

It’s great to see more and more internally and externally developed libraries add support for Compose. For example, loading pictures asynchronously can now be done with the GlideImage composable from the Glide library. And Google Maps released a library which makes it much easier to declaratively create your map implementations.

GoogleMap( //... ) { Marker( state = MarkerState(position = LatLng(-34, 151)), title = "Marker in Sydney" ) Marker( state = MarkerState(position = LatLng(35.66, 139.6)), title = "Marker in Tokyo" ) }

New and updated guidance

No matter where you are in your learning journey, we’ve got you covered! We added and revamped a lot of the guidance on Compose:

Happy Composing!

We hope you're as excited by these developments as we are! If you haven't started yet, it's time to learn Jetpack Compose and see how your team and development process can benefit from it. Get ready for improved velocity and productivity. Happy Composing!

Android Studio @ I/O ‘23: Announcing Studio Bot, an AI-powered coding assistant

Posted by Adarsh Fernando, Senior Product Manager, Android Studio

We first announced Android Studio at I/O 2013 with a promise to deliver a best-in-class integrated development environment (IDE) focused on Android app developers. 10 years later, this commitment to developer productivity still drives the team to deliver new tools and solutions that help teams around the world to create amazing app experiences for their users. And with Google's push to unlock the power of AI to help you throughout your day, Android Studio Hedgehog introduces a key breakthrough: an AI-powered conversational experience designed to make you more productive.

In addition to accelerating coding productivity, this latest version of the IDE provides better tools when you develop for multiple form factors, and helps you improve app quality with new insights, debugging, and testing solutions. All these improvements add to the many updates we’ve included in Android Studio Giraffe, which is now in the Beta channel and helps make it easier to configure your builds with Kotlin DSL support, improve sync times with new data and guidance, target the latest Android SDK version with the new Android SDK Upgrade Assistant, and more.

To see highlights of the new features in action including Studio Bot, watch the What’s new in Android Developer Tools session from Google I/O 2023.

What’s new in Android Development Tools - with Studio Bot Demo

Jump right in and download Android Studio Hedgehog, or learn more about the most exciting new features below.

Coding productivity

Introducing Android Studio Bot

At the heart of our mission is to accelerate your ability to write high-quality code for Android. In this release we are excited to introduce an AI-powered conversational experience called Studio Bot, that leverages Codey, Google's foundation model for coding that is a descendant of PaLM 2, to help you generate code for your app and make you more productive. You can also ask questions to learn more about Android development or help fix errors in your existing code — all without ever having to leave Android Studio. Studio Bot is in its very early days, and we’re training it to become even better at answering your questions and helping you learn best practices. We encourage you to try it out for yourselves, and help it improve by sharing your feedback directly with Studio Bot.

Privacy is top of mind, and what is unique in this integration is that you don’t need to send your source code to Google to use Studio Bot—only the chat dialogue between you and Studio Bot is shared. Much like our work on other AI projects, we stick to a set of principles that hold us accountable. We’re taking a measured approach to our rollout; for this initial launch, Studio Bot is only available to Android developers in the US. You can read more here

Studio Bot

Live Edit

Live Edit helps keep you in the flow by minimizing interruptions when you make updates to your Compose UI and validates those changes on a running device. You can use it in manual mode to control when the running app should be updated or in automatic mode to update the running app as you make code changes. Live Edit is available in Android Studio Giraffe Beta, with the Hedgehog release providing additional improvements in error handling and reporting.

Moving image showing live edit with Compose
Live Edit with Compose

Build productivity

Kotlin DSL and Version Catalogs

A number of updates help you leverage more modern syntax and conventions when configuring your build. Kotlin is the recommended language when developing for Android. Now, with official support for Kotlin DSL in your Gradle build scripts, it’s also the preferred way to configure your build because Kotlin is more readable and offers better compile-time checking and IDE support. Additionally, we’ve also added experimental 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 integrations with the Project Structure dialog, plus the New Project Wizard.

Screengrab showing Kotlin DSL and Version Catalogs in the New Project Wizard
Kotlin DSL and Version Catalogs in the New Project Wizard

Per-app language preferences

Typically, multilingual users set their system language to one language—such as English—but they want to select other languages for specific apps, such as Dutch, Chinese, or Hindi. Android 13 introduced support for per-app language preferences, and now Android Gradle plugin 8.1 and higher can configure your app to support it automatically. Learn more.

Download impact during Sync

When using Android Gradle Plugin 7.3 or higher, The Build > Sync tool window now includes a summary of time spent downloading dependencies and a detailed view of downloads per repository, so you can easily determine whether unexpected downloads are impacting build performance. Additionally, it can help you identify inefficiencies in how you configure your repositories. Learn more.

Screengrab of Build Analyzer showing impact of downloads during build
Build Analyzer showing impact of downloads during build

New Android SDK Upgrade Assistant

Android Studio Giraffe introduces the Android SDK Upgrade Assistant, a new tool that helps you upgrade the targetSdkVersion, which is the API level that your app targets. Instead of having to navigate every API change with an Android SDK release, the Android SDK Upgrade Assistant guides you through upgrading targetSdkVersion level by level by creating a customized filter of API changes that are relevant to your app. For each migration step, it highlights the major breaking changes and how to address them, helping you get to taking advantage of what the latest versions of Android have to offer much more quickly. To open the Android SDK Upgrade Assistant, go to Tools > Android SDK Upgrade Assistant. In the Assistant panel, select the API level that you want to upgrade to for guidance.

Screengrab of Build Analyzer showing impact of downloads during build
Upgrade more quickly with the Android SDK Upgrade Assistant

Developing for form factors

Google Pixel Fold and Tablet Virtual Devices

Although these devices won’t launch until later this year, you can start preparing your app to take full advantage of the expanded screen sizes and functionality of these devices by creating virtual devices using new Google Pixel Fold and Google Pixel Tablet device profiles in Android Studio Hedgehog. To start, open Device Manager and select Create Device.

Screengrab of Pixel Tablet running on the Android Emulator
Pixel Tablet running on the Android Emulator

Emulator Support for Wear OS 4 Developer Preview

Wear OS 4 is the next generation OS for Wear. Based on Android 13, it officially launches in the fall and has a great selection of new features and optimizations. We’re giving you a preview of all the new platform features with the new Wear OS 4 emulator. We recommend you try it with Android Studio Hedgehog and test that your Wear OS app works as intended with the latest platform updates. The Wear OS 4 emulator will give you a faster and smoother transition to Wear OS 4, and help you make apps ready in time for the official Wear OS 4 release on real devices. Check out the Wear 4 Preview site for how to get started with the new Wear OS 4 emulator.

Watch Face Format support in Wear OS 4 Emulator

Together with Samsung, we’re excited to announce the launch of the Watch Face Format, a new way to build watch faces for Wear OS. The Watch Face Format is a declarative XML format, meaning there will be no code in your watch face APK. The platform takes care of the logic needed to render the watch face so you no longer have to worry about code optimizations or battery performance. Use watch face creation tools such as Watch Face Studio to design watch faces, or you can manually or dynamically edit the watch face format to build watch faces directly. You can test the new Watch Face Format on the Wear OS 4 emulator.

Moving image of Watch Face Format Watchface on Wear 4 Emulator
Watch Face Format Watchface on Wear 4 Emulator

Device Mirroring for local devices

Whether you use a direct USB connection or ADB over Wi-Fi, Device Mirroring lets you see and interact with your local physical devices directly within the Android Studio Running Devices window. This feature lets you focus on how you develop and test your app all in one place. With the Hedgehog release, we’re adding more functionality, including the ability to mirror Wear OS devices and simulate folding actions on foldable devices directly from the IDE.

Screengrab showing device mirroring with the Pixel Fold
Device Mirroring with the Pixel Fold

Android Device Streaming

We know sometimes it’s critical for you to see and test how your apps work on physical hardware to ensure that your users have the best experience. However, accessing the latest flagship devices isn’t always easy. Building on top of Device Mirroring for local devices, we’re introducing device streaming of remote physical Google Pixel devices, such as the Pixel Fold and Pixel Tablet, directly within Android Studio. Device streaming will let you deploy your app to these remote devices and interact with them, all without having to leave the IDE. If you’re interested in getting early access later this year, enroll now.

Espresso Device API

Automated testing of your app using Espresso APIs helps you catch potential issues early, before they reach users. However, testing your app across configuration changes, such as rotating or folding a device, has always been a challenge. Espresso Device API is now available to help you write tests that perform synchronous configuration changes when testing on Android virtual devices running API level 24 and higher. You can also set up test filters to ensure that tests that require certain device features, such as a folding action, only run on devices that support them. Learn more.

Example of test code for synchronous device configuration changes using the Espresso Device API
Synchronous device configuration changes using the Espresso Device API

Improve your app quality

App Quality Insights with Android vitals

App Quality Insights launched in Android Studio Electric Eel to provide access to Firebase Crashlytics issue reports directly from the IDE. The integration lets you navigate between your stack trace and code with a click, use filters to see only the most important issues, and see report details to help you reproduce issues. In Android Studio Hedgehog, you can now view important crash reports from Android vitals, powered by Google Play. Android vitals reports also include useful insights, such as notes from SDK providers so that you can quickly diagnose and resolve crashes related to SDKs your app might be using.

Screengrab showing Android vitals crash reports in the App Quality Insights window
Android vitals crash reports in the App Quality Insights window

App Quality Insights with improved code navigation

When you publish your app using the latest version of AGP 8.2, crash reports now attach minimal git commit hash data to help Android Studio navigate to your code when investigating Crashlytics crash reports in the IDE. Now, when you view a report that includes the necessary metadata, you can choose to either navigate to the line of code in your current git checkout, or view a diff between the checkout and the version of your codebase that generated the crash. To get started with the right dependencies, see the documentation.

Compose State information in Debugger

When parts of your Compose UI recompose unexpectedly, it can sometimes be difficult to understand why. Now, when setting a breakpoint on a Composable function, the debugger lists the parameters of the composable and their state, so you can more easily identify what changes might have caused the recomposition. For example, when you pause on a composable, the debugger can tell you exactly which parameters have “Changed” or have remained “Unchanged”, so you can more efficiently investigate the cause of the recomposition.

Screengrab showing Compose state information in the debugger
Compose state information in the debugger

New Power Profiler

We are excited to announce a brand new Power Profiler in Android Studio Hedgehog, which shows power consumption on the Pixel 6 and higher devices running Android 10 and higher. Data is segmented by each sub-system (such as, Camera, GPS, and more). This data is made available when recording a System Trace via the Profiler and helps you to visually correlate power consumption of the device to the actions happening in your app. For example, you can A/B test multiple algorithms of your video calling app to optimize power consumed by the camera sensor.

Image of the new power profiler
The new Power Profiler

Device Explorer

The Device File Explorer in Giraffe has been renamed to Device Explorer and updated to include information about debuggable processes running on connected devices. In addition to the Files tab, which includes existing functionality that allows you to explore a device’s file hierarchy, the new Processes tab allows you to view a list of debuggable processes for the connected device. From there you can also select a process and perform a Kill process action (which runs am kill), a Force stop (which runs am force-stop) , or attach the debugger to a selected process.

Image of the new power profiler
Processes tab in the Device Explorer window

Compose animation preview

Compose Animation Preview in Android Studio Hedgehog now supports a number of additional Compose APIs, animate*AsState, CrossFade, rememberInfiniteTransition, and AnimatedContent (in addition to updateTransition and AnimatedVisibility). Compose Animation Preview also has new pickers that let you set non-enum or boolean states to debug your Compose animation using precise inputs. For all supported Compose Animation APIs, you can play, pause, scrub, control speed, and coordinate.

Moving image of Compose Animation preview
Compose Animation Preview

Embedded Layout Inspector

You can now run Layout Inspector directly embedded in the Running Device Window in Android Studio! Try out this feature today in Android Studio Hedgehog to conserve screen real estate and organize your UI debugging workflow in a single tool window. You can access common Layout Inspector features such as debugging the layout of your app by showing a view hierarchy and allowing you to inspect the properties of each view. Additionally, because the embedded Layout Inspector overlays on top of the existing device mirroring stream, overall performance when using the inspector is now much faster. To get started and understand known limitations, read the release notes.

Screengrab of embedded Layout Inspector
Embedded Layout Inspector

Firebase Test Lab support for Gradle Managed Devices

Gradle Managed Devices launched in Android Gradle Plugin (AGP) 7.3 to make it easier to utilize virtual devices when running automated tests in your continuous integration (CI) infrastructure by allowing Gradle to manage all aspects of device provisioning. All you need to do is use the AGP DSL to describe the devices you wanted Gradle to use. But sometimes you need to run your tests on physical Android devices. With AGP 8.2, we have expanded Gradle Managed Devices with the ability to target real physical (and virtual) devices running in Firebase Test Lab (FTL). The capability makes it easier than ever to scalably test across the large selection of FTL devices with only a few simple steps. Additionally, this version of AGP can also take advantage of FTL’s new Smart Sharding capabilities, which allows you to get test results back much more quickly by utilizing multiple devices that run in parallel. To learn more and get started, read the release notes.

Image of gradle managed devices with support for Firebase Test Lab
Gradle Managed Devices with support for Firebase Test Lab

IntelliJ

IntelliJ Platform Update

Android Studio Hedgehog (2023.1) includes the IntelliJ 2023.1 platform release, which comes with IDE startup performance improvements, faster import of Maven projects, and a more streamlined commit process. Read the IntelliJ release notes here.

New UI

Along with the IntelliJ platform update comes further improvements to the New UI. In large part due to community feedback, there’s a new Compact Mode, which provides a more consolidated look and feel of the IDE, and an option to vertically split the tool window area and conveniently arrange the windows, just like in the old UI. We also improved the Android-specific UI by updating the main toolbar, tool windows, and new iconography. To use the New UI, enable it in Settings > Appearance & Behavior > New UI. For a full list of changes, see the IntelliJ New UI documentation.

Screengrab showing the new UI adopted from IntelliJ
The New UI adopted from IntelliJ

Summary

To recap, Android Studio Giraffe is available in the Beta channel. Android Studio Hedgehog is the latest version of the IDE and is available in the Canary channel, and includes all of these new enhancements and features:

Coding productivity

  • Android Studio Bot, is a tightly integrated, AI-powered assistant in Android Studio designed to make you more productive.
  • (Beta) Live Edit, which helps keep you in the flow by minimizing interruptions when you make updates to your Compose UI and validate those changes on a running device.

Build productivity

  • (Beta) Kotlin DSL and Version Catalogs, which helps you take advantage of more modern syntax and conventions when configuring your build.
  • (Beta) Per-app language preferences, built-in support in AGP for automatically configuring per-app language preferences.
  • (Beta) Download impact in Build Analyzer, which provides a summary of time spent downloading dependencies and a detailed view of downloads per repository, so you can easily determine whether unexpected downloads are impacting build performance.
  • (Beta) New Android SDK Upgrade Assistant, which helps you upgrade the targetSdkVersion, which is the API level that your app targets, much more quickly.

Developing for form factors

  • Google Pixel Fold and Google Pixel Tablet Virtual Devices, which can help you start preparing your app to take full advantage of the expanded screen sizes and functionality of these devices before they are available in stores.
  • Wear OS 4 Developer Preview Emulator, which similarly provides you early access to test and optimize your app against the next generation of Wear OS by Google.
  • Watch Face Format support in Wear OS 4 Developer Preview Emulator, a new way to build watch faces for Wear OS.
  • Device Mirroring for local devices, which lets you see and interact with your local physical devices directly within Android Studio’s Running Devices window.
  • Android Device Streaming, a device streaming of remote physical Google Pixel devices, which you can register for early access today!
  • Espresso Device API, which helps you write tests that perform synchronous configuration changes when testing on Android virtual devices running API level 24 and higher.

Improve your app quality

  • App Quality Insights: Android vitals, which now lets your view, filter, and navigate important crash reports from Android vitals, powered by Google Play.
  • App Quality Insights with improved code navigation, which lets you now choose to either navigate to the line of code in your current git checkout, or view a diff between the checkout and the version of your codebase that generated the crash.
  • Compose State information in Debugger, which lists the parameters of the composable and their state when paused on a breakpoint in a composable, so you can more easily identify what changes might have caused the recomposition.
  • New Power Profiler, which shows highly accurate power consumption from the device segmented by each sub-system.
  • (Beta) Device Explorer, which now includes information about debuggable processes running on connected devices and actions you can perform on them.
  • (Beta) Compose animation preview, now supports a number of additional Compose APIs and new pickers that let you set non-enum or boolean states to debug your Compose animation using precise inputs.
  • Embedded Layout Inspector, which runs Layout Inspector directly embedded in the Running Device Window in Android Studio, leading to a more seamless debugging experience and significant performance improvements.
  • Firebase Test Lab support for Gradle Managed Devices, which leverages GMD to help you seamlessly configure Firebase Test Lab devices for your automated testing, and now with additional support for smart sharding.

IntelliJ

  • IntelliJ Platform Update to the IntelliJ 2023.1 platform release, which includes a number of performance and quality of life improvements.
  • New UI update that allows Android Studio to adopt a number of improvements to IntilliJ’s modern design language.

See the Android Studio Preview release notes and the Android Emulator release notes for more details.


Download Android Studio Today!

You can download Android Studio Hedgehog Canary or Android Studio Giraffe Beta today to incorporate the new features into your workflow. You can install them side by side with a stable version of Android Studio by following these instructions. The Beta release is near stable release quality, but bugs might still exist, and Canary features are leading edge features. As always, we appreciate any feedback on things you like or features you would like to see. If you find a bug, please report the issue and also check out known issues. Remember to also follow us on Twitter, Medium, or YouTube for more Android development updates!