Android Developers Blog
The latest Android and Google Play news for app and game developers.
🔍
Platform Android Studio Google Play Jetpack Kotlin Docs News

31 Oktober 2024

Gemini in Android Studio, now helping you across the development lifecycle


Link copied to clipboard
Posted by Sandhya Mohan – Product Manager, Android Studio

This is Our Biggest Feature Release Since Launch!

AI can accelerate your development experience, and help you become more productive. That's why we introduced Gemini in Android Studio, your AI-powered coding companion. It’s designed to make it easier for you to build high quality Android apps, faster. Today, we're releasing the biggest set of updates to Gemini in Android Studio since launch, and now Gemini brings the power of AI to every stage of the development lifecycle, directly within the Android Studio IDE experience. And for more updates on how to grow your apps and games businesses, check out the latest updates from Google Play.

Download the latest version of Android Studio in the canary channel to take advantage of all these new features, and read on to unpack what's new.



Gemini Can Now Write, Refactor, and Document Android Code

Gemini goes beyond just guidance. It can edit your code, helping you quickly move from prototype to implementation, implement common design patterns, and refactor your code. Gemini also streamlines your workflow with features like documentation and commit message generation, allowing you to focus more time on writing code.

Moving image demonstrating Gemini writing code for an Android Composable in real time in Android Studio

Coding features we are launching include:

    • Gemini Code Transforms - modify and refactor code using custom prompts.

      using Gemini to modify code in Android Studio

    • Commit message generation - analyze changes and propose VCS commit messages to streamline version control operations.

      using Gemini to analyze changes and propose VCS commit messages in Android Studio

    • Rethink and Rename - generate intuitive names for your classes, methods, and variables. This can be invoked while you’re coding, or as a larger refactor action applied to existing code.

      using Gemini to generate intuitive names for variables while you're coding in Android Studio

    • Prompt library - save and manage your most frequently used prompts. You can quickly recall them when you need them.

      save your frequently used prompts for future use with Gemini in Android Studio

    • Generate documentation - get documentation for selected code snippets with a simple right click.

      generating code documation in Android Studio

Integrating AI into UI Tools

It’s never been easier to build with Compose now that we have integrated AI into Compose workflows. Composable previews help you visualize your composables during design time in Android Studio. We understand that manually crafting mock data for the preview parameters can be time-consuming. Gemini can now help auto-generate Composable previews with relevant context using AI, simplifying the process of visualizing your UI during development.

Visualize your composables during design time in Android Studio

We are continuing to experiment with Multimodal support to speed up your UI development cycle. Coming soon, we will allow for image attachment as context and utilizing Gemini's multimodal understanding to make it easier to create beautiful and engaging user interfaces.

Deploy with Confidence

Gemini's intelligence can help you release higher quality apps with greater confidence. Gemini can analyze, test code, and suggest fixes — and we are continuing to integrate AI into the IDE’s App Quality Insights tool window by helping you analyze crashes reported by Google Play Console and Firebase Crashlytics. Now, with Ladybug Feature Drop, you can generate deeper insights by using your local code context. This means that you will fix bugs faster and your users will see fewer crashes.

Generate insights using the IDE's App Quality Insights tool window

Some of the features we are launching include:

    • Unit test scenario generation generates unit test scenarios based on local code context.

    generate unit test scenarios based on local code context in Android Studio

      • Build / sync error insights now provides improved coverage for build and sync errors.

        build sync error insights are now avaiable in Android Studio

      • App Quality Insights explains and suggests fixes for observed crashes from Android Vitals and Firebase Crashlytics, and now allows you to use local code context for improved insights.

        save your frequently used prompts for future use with Gemini in Android Studio

    A better Gemini in Android Studio for you

    We recently surveyed many of you to see how AI-powered code completion has impacted your productivity, and 86% of respondents said they felt more productive. Please continue to provide feedback as you use Gemini in your day-to-day workflows. In fact, a few of you wanted to share some of your tips and tricks for how to get the most out of Gemini in Android Studio.



    Along with the Gemini Nano APIs that you can integrate with your own app, Android developers now have access to Google's leading edge AI technologies across every step of their development journey — with Gemini in Android Studio central to that developer experience.

    Get these new features in the latest versions of Android Studio

    These features are all available to try today in the Android Studio canary channel. We expect to release many of these features in the upcoming Ladybug Feature Drop, to be released in the stable channel in late December — with the rest to follow shortly after.

      • Gemini Code Transforms - Modify and refactor your code within the editor
      • Commit message generation - Automatically generate commit messages with Gemini
      • Rethink and Rename - Get help renaming your classes, methods, and variables
      • Prompt library - Save and recall your most commonly used prompts
      • Compose Preview Generation - Generate previews for your composables with Gemini
      • Generate documentation - Have Gemini help you document your code
      • Unit test scenario generation - Generate unit test scenarios
      • Build / sync error insights - Ask Gemini for help in troubleshooting build and sync errors
      • App Quality Insights - Insights on how you can fix crashes from Android Vitals and Firebase Crashlytics

    As always, Google is committed to the responsible use of AI. Android Studio won't send any of your source code to servers without your consent — which means you'll need to opt in to enable Gemini's developer assistance features in Android Studio. You can read more on Gemini in Android Studio's commitment to privacy.

    Try enabling Gemini in your project and tell us what you think on social media with #AndroidGeminiEra. We're excited to see how these enhancements help you build amazing apps!