How can I specify a BOM in a multiplatform project...
# gradle
c
How can I specify a BOM in a multiplatform project?
Copy code
kotlin {
    jvm()
    android()

    sourceSets {
        val androidMain by getting {
            dependencies {
                implementation(platform(libs.androidx.compose.bom)) // Unresolved reference: platform
                implementation(libs.androidx.compose.material3)
            }
        }
    }
}
either don't use version catalog or switch to the top-level dependencies block
e.g.
Copy code
dependencies {
    "androidMainImplementation"(platform(...))
}
c
I just migrated to the version catalogs 😅
I'll use the top-level for just that dependency then, and migrate it when it's fixed
a
could you try this?
Copy code
implementation(project.dependencies.platform(libs.androidx.compose.bom))
c
@Adam S it compiles
I get
e: java.lang.Error: Something went wrong while checking for version compatibility between the Compose Compiler and the Kotlin Compiler.  It is possible that the versions are incompatible.
though (did not touch the versions)
e
you can check what it resolved to but I don't think that works currently. ideally it should, though
c
How can I check?
I get the same message with the top-level dependencies block
e
Copy code
./gradlew dependencies --configuration androidMainCompileClasspath
and see if the bom constraints appear
c
Configuration 'androidMainCompileClasspath' not found in configuration container.
🤔
Ah, I'm on Kotlin 1.7.20 and that was renamed in 1.8.0, right?
e
oh. then try a top-level
Copy code
dependencies {
    implementation(platform(...))
c
Copy code
releaseCompileClasspath - Resolved configuration for compilation for variant: release
+--- org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.7.20
|    +--- org.jetbrains.kotlin:kotlin-stdlib:1.7.20
|    |    \--- org.jetbrains:annotations:13.0
|    \--- org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.7.20
|         \--- org.jetbrains.kotlin:kotlin-stdlib:1.7.20 (*)
+--- androidx.compose:compose-bom:2023.01.00
|    +--- androidx.compose.material3:material3:1.0.1 (c)
|    +--- androidx.compose.material3:material3-window-size-class:1.0.1 (c)
|    +--- androidx.compose.foundation:foundation:1.3.1 (c)
|    +--- androidx.compose.material:material-icons-core:1.3.1 (c)
|    +--- androidx.compose.material:material-ripple:1.3.1 (c)
|    +--- androidx.compose.runtime:runtime:1.3.3 (c)
|    +--- androidx.compose.ui:ui:1.3.3 (c)
|    +--- androidx.compose.ui:ui-graphics:1.3.3 (c)
|    +--- androidx.compose.ui:ui-text:1.3.3 (c)
|    +--- androidx.compose.ui:ui-unit:1.3.3 (c)
|    +--- androidx.compose.animation:animation:1.3.3 (c)
|    +--- androidx.compose.runtime:runtime-saveable:1.3.3 (c)
|    +--- androidx.compose.ui:ui-geometry:1.3.3 (c)
|    +--- androidx.compose.animation:animation-core:1.3.3 (c)
|    \--- androidx.compose.foundation:foundation-layout:1.3.1 (c)
I'll be migrating to Kotlin 1.8.0 in the coming week or so
e
well that looks like a bom applied
c
Should I just ignore the compatibility warning then? (how?)
e
oh now that I check the message you posted
that has nothing to do with the bom
a
do you know which version of the 'Compose Compiler' your project has? I can't see it under the compile classpath, but maybe I've missed it. According to this https://developer.android.com/jetpack/androidx/releases/compose-kotlin it should be 1.3.2 (since you're using Kotlin 1.7.20), but possibly the warning is being triggered before the version has been resolved...?
c
I have the
compose-jb
plugin 1.2.1, if that helps
844 Views