I have declared the firebase bom in my toml file l...
# gradle
j
I have declared the firebase bom in my toml file like so
Copy code
[libraries]
firebase-BoM = { module = "com.google.firebase:firebase-bom", version = "32.4.1" }
firebase-crashlytics-gradle = { module = "com.google.firebase:firebase-crashlytics-gradle", version.ref = "firebaseCrashlyticsGradle" }
firebase-crashlytics-kts = { module = "com.google.firebase:firebase-crashlytics-ktx" }
firebase-functions = { module = "com.google.firebase:firebase-functions-ktx" }
firebase-appcheck-ktx = { module = "com.google.firebase:firebase-appcheck-ktx" }
firebase-appcheck-playintegrity = { module = "com.google.firebase:firebase-appcheck-playintegrity" }
firebase-appcheck-debug = { module = "com.google.firebase:firebase-appcheck-debug" }

[bundles]
firebase = [
    "firebase-BoM",
    "firebase-crashlytics-kts",
    "firebase-functions",
    "firebase-appcheck-ktx",
    "firebase-appcheck-playintegrity",
    "firebase-appcheck-debug"
]
But when I try to include it in my
build.gradle.kts
with
_api_(platform(_libs_._bundles_.firebase))
I get the following error :
Copy code
Cannot convert the provided notation to an object of type Dependency: [com.google.firebase:firebase-bom:32.4.1, com.google.firebase:firebase-crashlytics-ktx, com.google.firebase:firebase-functions-ktx, com.google.firebase:firebase-appcheck-ktx, com.google.firebase:firebase-appcheck-playintegrity, com.google.firebase:firebase-appcheck-debug].
The following types/formats are supported:
  - String or CharSequence values, for example 'org.gradle:gradle-core:1.0'.
  - Maps, for example [group: 'org.gradle', name: 'gradle-core', version: '1.0'].
  - FileCollections, for example files('some.jar', 'someOther.jar').
  - Projects, for example project(':some:project:path').
  - ClassPathNotation, for example gradleApi().
If I only use
_api_(_libs_._bundles_.firebase)
it works fine but the documentation uses
platform
and I don’t know what it actually do/imply. What should I use here?
a
the error message isn't really helpful, but
platform()
is basically only for Maven BOMs (docs), and is used to align the versions of dependencies contained in that BOM. If you wanted to follow what the Firebase docs are using and use the version catalog, then you'd want to remove the BOM from the Firebase bundle, and use this in the build script:
Copy code
implementation(platform(libs.firebase.BoM))
implementation(libs.bundles.firebase)
j
Nice, thanks!
fist bump 1
480 Views