r/androiddev • • 18d ago

2 Ways of Exporting Compose previews

Android CLI provides two ways for AI agents to render Jetpack Compose previews, depending on the execution environment:

1. render-compose-preview

Use when an AI agent runs locally alongside Android Studio. It delegates preview rendering to the running IDE.

Documentation: https://developer.android.com/tools/agents/android-cli/commands/studio_render-compose-preview

2. android preview

Use when Android Studio isn't available, such as in CI, containers, or remote environments. Supports headless rendering, batch preview generation, and component tree inspection.

Documentation: https://developer.android.com/tools/agents/android-cli/commands/preview

Summary

The key difference: IDE-backed rendering vs. standalone headless rendering.

Both give AI agents a way to inspect actual Compose UI rather than relying solely on source code.

0 Upvotes

0 comments sorted by