AI features in Studio Labs

We've heard feedback that developers want to access AI features in stable channels as soon as possible. Starting with the Android Studio Narwhal stable release, you can discover and try out the latest AI experimental features through Studio Labs. Studio Labs lets you enable AI experimental features in a stable version of Android Studio, so you can test out the latest AI offerings with just a few clicks. If you're using a canary version of Android Studio, these AI experimental features are enabled by default.

To get started with Studio Labs, go to File (Android Studio on macOS) > Settings > Studio Labs and enable the features that you'd like to start using. You can get a first look at AI experiments, share your feedback, and help us incorporate the experiments into the IDE that you use everyday.

AI features in Studio Labs
AI features in Studio Labs

Studio Labs features

Compose preview generation with Gemini

Gemini can automatically generate Jetpack Compose preview code saving you time and effort. You can access this feature by right-clicking within a composable and navigating to Gemini > Generate Compose Preview or Generate Compose Preview for this file, or by clicking the link in an empty preview panel. The generated preview code is presented in a diff view that lets you to quickly accept, edit, or reject the suggestions, providing a faster way to visualize your composables.

Compose Preview generation with Gemini
Compose Preview generation with Gemini

Image attachment in Gemini

You can now attach image files and provide additional information along with your prompt. For example: you can attach UI mock-ups or screenshots to tell Gemini context about your app's layout. Consequently, Gemini can generate Compose code based on a provided image, or explain the composables and data flow of a UI screenshot.

Gemini dialog with Image Attachments
Image attachment & preview generation using Gemini in Android Studio

@File context in Gemini

You can now attach your project files as context in chat interactions with Gemini in Android Studio. This lets you quickly reference files in your prompts for Gemini. In the Gemini chat input, type @ to bring up a file completion menu and select files to attach. You can also click the Context drop-down to see which files were automatically attached by Gemini. This gives you more control over the context sent to Gemini.

@File context in Gemini
@File context in Gemini