Tools for Compose
Android Studio brings a lot of new features specifically for Jetpack Compose. It embraces a code-first approach while improving the developer productivity without having to choose between using design interface or code editor.
A fundamental difference between View-based UI and Jetpack Compose is that Compose doesn't rely on
View to render its composables. As a consequence of this architecture approach, Android Studio offers extended features for Jetpack Compose without having to open an emulator or connect to a device. Compared to Android Views, this allows a faster, iterative process for developers to implement their UI designs.
To enable Android Studio-specific features for Jetpack Compose, you need to add these dependencies in your application
build.gradle(.kts) file. You can either use the Bill of Materials (BOM) or define dependencies individually.
Bill of Materials
val composeBom = platform("androidx.compose:compose-bom:2023.10.01") implementation(composeBom) debugImplementation("androidx.compose.ui:ui-tooling") implementation("androidx.compose.ui:ui-tooling-preview")
@Previewannotation allows you to preview your composables. Learn how to preview, organize, and interact with them.