I have migrated from string version dependencies i...
# gradle
v
I have migrated from string version dependencies in my
build.gradle.kts
to the centralized
libs.versions.toml
version catalog. I have done so by letting Android Studio do the work for me by mashing the
alt + enter
keys for every highlighted dependency inside the
build.gradle.kts
file. However, when all was said and done, looking at what the Android Studio has done, I have some doubts and concerns. For instance:
Copy code
[versions]
activityKtx = "1.9.0"

[libraries]
androidx-activity-compose = { module = "androidx.activity:activity-compose", version.ref = "activityKtx" }
androidx-activity-ktx = { module = "androidx.activity:activity-ktx", version.ref = "activityKtx" }
Now, I am not entirely sure if it is actually correct that
androidx-activity-compose
depends on the same version reference as
activity-ktx
and also shares the same version name (
activityKtx
)? Looking at the Google docs, they seem to be shipped together:
Copy code
androidx.activity:activity:1.9.0, androidx.activity:activity-compose:1.9.0, and androidx.activity:activity-ktx:1.9.0 are released. Version 1.9.0 contains these commits.
But still, it worries me somewhat? Is this correct?
d
Since they share a group-id, and appear to be part of the same project, I wouldn't be surprised if they share a version. That's not an uncommon pattern. I might rename the version id, something like
androidx-activity = "1.9.0"
.
Also, if it turns out that in the future you need different versions, you can just split it up.
v
I see, thank you very much
👍 1
c
typically there would be a bom to represent the group of related dependencies, such that you reference the bom version once and then other deps w/o a version, to avoid guesswork as to what deps are versioned together.
plus1 1