As there are many different versions of the Jetpack Compose library while adding the dependencies in
the Gradle file. So it is very hard to manage those Jetpack compose libraries individually. So to make Jetpack Compose dependencies easier by using a BOM which is a Maven module that declares a set of libraries with their versions. It is similar to BOM we are using for implementing Firebase dependency in our Gradle file.

Before BOM we have to add dependency version for each compose library in Gradle file

implementation ‘androidx.compose.ui:ui:1.4.4.0-alpha04’
implementation ‘androidx.compose.ui:ui-graphics:1.4.0-alpha04’
implementation ‘androidx.compose.ui:ui-tooling-preview:1.4.0-alpha04’
implementation ‘androidx.compose.material3:material3:1.1.0-alpha04’

When we add  BOM dependency in our Gradle file mention below

implementation platform(‘androidx.compose:compose-bom:2022.10.00’)
implementation ‘androidx.compose.ui:ui’
implementation ‘androidx.compose.ui:ui-graphics’
implementation ‘androidx.compose.ui:ui-tooling-preview’
implementation ‘androidx.compose.material3:material3’
androidTestImplementation platform(‘androidx.compose:compose-bom:2022.10.00’)
debugImplementation ‘androidx.compose.ui:ui-tooling’
debugImplementation ‘androidx.compose.ui:ui-test-manifest’

For testing purpose we have to add androidTestImplementation BOM dependency

androidTestImplementation platform(‘androidx.compose:compose-bom:2022.10.00’)

Also check the official Blog from Android Developers Blog

https://android-developers.googleblog.com/2022/10/whats-new-in-jetpack-compose.html

 

By admin

One thought on “Manage Jetpack Compose Dependencies With Ease”

Leave a Reply

Your email address will not be published. Required fields are marked *