dependencies{// Specify the Compose BOM with a version definitionvalcomposeBom=platform("androidx.compose:compose-bom:2025.08.00")implementation(composeBom)testImplementation(composeBom)androidTestImplementation(composeBom)// Specify Compose library dependencies without a version definitionimplementation("androidx.compose.foundation:foundation")// ..testImplementation("androidx.compose.ui:ui-test-junit4")// ..androidTestImplementation("androidx.compose.ui:ui-test")}
Groovy
dependencies{// Specify the Compose BOM with a version definitionDependencycomposeBom=platform('androidx.compose:compose-bom:2025.08.00')implementationcomposeBomtestImplementationcomposeBomandroidTestImplementationcomposeBom// Specify Compose library dependencies without a version definitionimplementation'androidx.compose.foundation:foundation'// ..testImplementation'androidx.compose.ui:ui-test-junit4'// ..androidTestImplementation'androidx.compose.ui:ui-test'}
dependencies{// Specify the Compose BOM with a version definitionvalcomposeBom=platform("androidx.compose:compose-bom:2025.08.00")implementation(composeBom)// Override the BOM version when neededimplementation("androidx.compose.animation:animation:1.9.0-alpha02")// ..}
Groovy
dependencies{// Specify the Compose BOM with a version definitionDependencycomposeBom=platform("androidx.compose:compose-bom:2025.08.00")implementationcomposeBom// Override the BOM version when neededimplementation'androidx.compose.animation:animation:1.9.0-alpha02'// ..}
dependencies{// Specify the Compose BOM with a version definitionvalcomposeBom=platform("androidx.compose:compose-bom-alpha:2025.08.00")// or platform("androidx.compose:compose-bom-beta:2025.08.00")implementation(composeBom)// ..}
Groovy
dependencies{// Specify the Compose BOM with a version definitionDependencycomposeBom=platform('androidx.compose:compose-bom-alpha:2025.08.00')// or platform('androidx.compose:compose-bom-beta:2025.08.00')implementationcomposeBom// ..}
[[["容易理解","easyToUnderstand","thumb-up"],["確實解決了我的問題","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["缺少我需要的資訊","missingTheInformationINeed","thumb-down"],["過於複雜/步驟過多","tooComplicatedTooManySteps","thumb-down"],["過時","outOfDate","thumb-down"],["翻譯問題","translationIssue","thumb-down"],["示例/程式碼問題","samplesCodeIssue","thumb-down"],["其他","otherDown","thumb-down"]],["上次更新時間:2025-08-21 (世界標準時間)。"],[],[],null,["# Use a Bill of Materials\n\nThe Compose Bill of Materials (BOM) lets you manage all of your Compose library\nversions by specifying\nonly the BOM's version. The BOM itself has links to the stable versions of the\ndifferent Compose libraries, in such a way that they work well together. When\nusing the BOM in your app, you don't need to add\nany version to the Compose library dependencies themselves. When you update the\nBOM version, all the libraries that you're using are automatically updated\nto their new versions. \n\n### Kotlin\n\n```kotlin\ndependencies {\n // Specify the Compose BOM with a version definition\n val composeBom = platform(\"androidx.compose:compose-bom:2025.08.00\")\n implementation(composeBom)\n testImplementation(composeBom)\n androidTestImplementation(composeBom)\n\n // Specify Compose library dependencies without a version definition\n implementation(\"androidx.compose.foundation:foundation\")\n // ..\n testImplementation(\"androidx.compose.ui:ui-test-junit4\")\n // ..\n androidTestImplementation(\"androidx.compose.ui:ui-test\")\n}\n```\n\n### Groovy\n\n```groovy\ndependencies {\n // Specify the Compose BOM with a version definition\n Dependency composeBom = platform('androidx.compose:compose-bom:2025.08.00')\n implementation composeBom\n testImplementation composeBom\n androidTestImplementation composeBom\n\n // Specify Compose library dependencies without a version definition\n implementation 'androidx.compose.foundation:foundation'\n // ..\n testImplementation 'androidx.compose.ui:ui-test-junit4'\n // ..\n androidTestImplementation 'androidx.compose.ui:ui-test'\n}\n```\n\nTo find out which Compose library versions are mapped to a specific BOM version,\ncheck out the [BOM to library version mapping](/develop/ui/compose/bom/bom-mapping).\n\n### Why isn't the Compose Compiler library included in the BOM?\n\nThe Compose Kotlin compiler extension (androidx.compose.compiler) is not linked\nto the Compose library versions. Instead, it is linked to versions of the Kotlin\ncompiler plugin and released in a separate cadence from the rest of Compose.\n\nAs of Kotlin 2.0, the Compose appcompiler is managed alongside the Kotlin\ncompiler and uses the same version as the Kotlin compiler.\nSee [Compose Compiler Gradle plugin](/develop/ui/compose/compiler) for\nconfiguration details.\n\nPrior to Kotlin 2.0, you need to make sure to use a version that is compatible\nwith your version of Kotlin. You can find the Kotlin version that maps to each\nversion of the plugin at\n[Compose to Kotlin Compatibility Map](/jetpack/androidx/releases/compose-kotlin), and how to\nconfigure it at [Compose Compiler](/jetpack/androidx/releases/compose-compiler).\n\n### How do I use a different library version than what's designated in the BOM?\n\nIn the `build.gradle` dependencies section, keep the import of the BOM\nplatform. On the library dependency import, specify the overriding version. For\nexample, here's how to declare\ndependencies if you want to use a newer version of the animation library, no\nmatter what version is designated in the BOM: \n\n### Kotlin\n\n```kotlin\ndependencies {\n // Specify the Compose BOM with a version definition\n val composeBom = platform(\"androidx.compose:compose-bom:2025.08.00\")\n implementation(composeBom)\n\n // Override the BOM version when needed\n implementation(\"androidx.compose.animation:animation:1.9.0-alpha02\")\n\n // ..\n}\n```\n\n### Groovy\n\n```groovy\ndependencies {\n // Specify the Compose BOM with a version definition\n Dependency composeBom = platform(\"androidx.compose:compose-bom:2025.08.00\")\n implementation composeBom\n\n // Override the BOM version when needed\n implementation 'androidx.compose.animation:animation:1.9.0-alpha02'\n\n // ..\n}\n```\n| **Note:** Overriding the BOM to use an alpha version of a Compose library will update your build to use the required dependencies of that alpha library (which in turn, could be alpha).\n\n### Does the BOM automatically add all the Compose libraries to my app?\n\nNo. To actually add and use Compose libraries in your app, you must declare each\nlibrary as a separate dependency line in your module (app-level) Gradle file\n(usually app/build.gradle).\n\nUsing the BOM ensures that the versions of any Compose libraries in your app are\ncompatible, but the BOM doesn't actually add those Compose libraries to your\napp.\n\n### Why is the BOM the recommended way to manage Compose library versions?\n\nGoing forward, Compose libraries will be versioned independently, which means\nversion numbers will start to be incremented at their own pace. The latest\nstable releases of each library are tested together. However, finding the\nlatest stable versions of each library can be difficult, and the BOM helps you\nto automatically use these latest versions.\n\n### Am I forced to use the BOM?\n\nNo. You can still choose to add each dependency version manually. However, we\nrecommend using the BOM as it will make it easier to use all of the latest\nstable versions at the same time.\n\n### Does the BOM work with version catalogs?\n\nYes. You can include the BOM itself in the version catalog, and omit the other\nCompose library versions: \n\n [libraries]\n androidx-compose-bom = { group = \"androidx.compose\", name = \"compose-bom\", version.ref = \"androidxComposeBom\" }\n androidx-compose-foundation = { group = \"androidx.compose.foundation\", name = \"foundation\" }\n\nDon't forget to import the BOM in your module's `build.gradle`: \n\n### Kotlin\n\n```kotlin\ndependencies {\n val composeBom = platform(libs.androidx.compose.bom)\n implementation(composeBom)\n androidTestImplementation(composeBom)\n\n // import Compose dependencies as usual\n}\n```\n\n### Groovy\n\n```groovy\ndependencies {\n Dependency composeBom = platform(libs.androidx.compose.bom)\n implementation composeBom\n androidTestImplementation(composeBom)\n\n // import Compose dependencies as usual\n}\n```\n\n### What if I want to try out alpha or beta releases of Compose libraries?\n\nThere are three available Compose BOMs. Each BOM is a point-in-time snapshot\nof the latest-available versions of Compose libraries.\n\n- Stable - contains latest stable versions of each library\n- Beta - contains latest beta, release candidate (RC), or stable versions of each library\n- Alpha - contains latest alpha, beta, RC, or stable versions of each library\n\nThe Alpha and Beta versions of the BOM are specified by adding `-alpha` and\n`-beta` to the BOM artifact name. The stable version has no suffix.\n**Note:** The alpha and beta BOMs are provided for testing of upcoming features and bug fixes. They are not intended for production use. These BOMs do not *only* contain alpha and beta versions. If the latest stable version of a library is higher than the latest alpha, beta, or RC versions, that stable version will appear in the alpha and beta BOMs. If the latest version is a Beta or RC, that version will appear in the alpha and beta BOMs. \n\n### Kotlin\n\n```kotlin\ndependencies {\n // Specify the Compose BOM with a version definition\n val composeBom = platform(\"androidx.compose:compose-bom-alpha:2025.08.00\")\n // or platform(\"androidx.compose:compose-bom-beta:2025.08.00\")\n implementation(composeBom)\n // ..\n}\n```\n\n### Groovy\n\n```groovy\ndependencies {\n // Specify the Compose BOM with a version definition\n Dependency composeBom = platform('androidx.compose:compose-bom-alpha:2025.08.00')\n // or platform('androidx.compose:compose-bom-beta:2025.08.00')\n implementation composeBom\n // ..\n}\n```\n\n### How do I report an issue or offer feedback on the BOM?\n\nYou can file issues on our [issue tracker](https://issuetracker.google.com/issues/new?component=612128&template=1253476).\n\nRecommended for you\n-------------------\n\n- Note: link text is displayed when JavaScript is off\n- [Material Design 3 in Compose](/develop/ui/compose/designsystems/material3)\n- [ConstraintLayout in Compose](/develop/ui/compose/layouts/constraintlayout)\n- [Resources in Compose](/develop/ui/compose/resources)"]]