Jetpack Compose: BOM

A quick look at the Compose Bill of Materials.

Mansi Shah
Jetpack Composers
Published in
2 min readOct 31, 2022

--

What is BOM?

The Bill of Materials (BOM) will allow you to manage versions of all your Compose libraries by specifying only the BOM’s version. The BOM has links to the stable versions of the different Compose libraries, in such a way that all the libraries that you’re using in your app are automatically updated to their new versions.

Why use BOM?

What it offers:

  • BOM helps you to automatically use the latest versions of Compose libraries.
  • Various Jetpack Compose libraries are moved to independent versioning, so it’s easy to use all of the latest stable versions at the same time.
  • Using the BOM ensures that the versions of any Compose libraries in your app are compatible.
  • BOM works with version catalogs too.

What it doesn’t:

  • BOM doesn’t actually add the Compose libraries to your app, you must declare each library as a dependency in the Gradle file.
  • Compose Compiler library isn’t included in the BOM.

You can still add each dependency version manually. BOM is not mandatory, it provides a way to make library upgrades easy.

How to use BOM?

Add the below Compose BOM dependency in the app/build.gradle file. Make sure you have target SDK version 33. After importing the dependency successfully, declare all your compose libraries in the Gradle dependencies block without versions as shown below.

Now how to use a different library version than the one declared in the BOM? In the dependencies section, on the library dependency import, specify the desired version. For example, if you want to use an alpha version of Material 3, add a dependency implementation 'androidx.compose.material3:material3:1.1.0-alpha01'no matter what version is designated in the BOM, it will consider the declared alpha version of material 3.

That’s it! Now whenever you will update the BOM version from 2022.10.00 to the new version, all other compose library versions will be extracted from that automatically.

To find out which Compose library versions are mapped to a specific BOM version, check out the BOM to Library version mapping

That’s a wrap for now! Many more to come 💥
You can access the source code from Github.
I hope you find this blog helpful.

--

--

Mansi Shah
Jetpack Composers

Lead Android Engineer. Hands-on experience in Java, Kotlin, and Dart. Obsessed with Jetpack Compose! Travel Geek. Painting Lover. https://linktr.ee/mansik15