Use Gemini in Android Studio to empower faster, better development with Jetpack Compose.
Compose preview generation with Gemini
Compose previews are a powerful tool for visualizing composables at design time in Android Studio, but manually setting up mock data for the preview parameters can be time-consuming. Gemini in Android Studio includes a feature that solves this problem: automated Compose preview generation.
You can access this tool in two ways:
- Context menu. Within any composable, right-click and navigate to Gemini > Generate Compose Preview or Generate Compose Preview for this file.
- Empty preview panel. Click the provided link in an empty preview panel.
The feature presents a diff view with Gemini's suggested Compose preview code. You can accept the changes as is, make edits, or reject the suggestions altogether. While Gemini's code might not be perfect every time, it should provide a valuable starting point to accelerate your development workflow.
Speed up UI development with image attachment
Attach images to your questions for Gemini in Android Studio to better understand an app's architecture and accelerate the UI development process.
To attach an image to your prompt, click Attach Image File
and upload the image.
Here are just a couple ways Gemini can help with images:
If you have a mock-up of the UI you'd like, Gemini can provide the code that creates it. Here we've shown Gemini a screenshot of the Now in Android app and asked it to provide the Compose code to create it.
If you want to learn how an app is constructed, Gemini can explain how the UI works in terms of its component parts. Here we've asked Gemini to explain the composables and data flow behind another Now in Android screenshot.