I notice that I can comment out implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
without any errors though I use ConstraintLayout in my app.
dependencies {
implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'com.google.android.material:material:1.3.0'
// implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
implementation 'androidx.navigation:navigation-fragment:2.3.3'
}
Why is it ok? Does the com.google.android.material library also contain constraintLayout?
It's indeed coming from com.google.android.material:material:1.3.0
- but when you don't declare it explicitly, you'll build against version 2.0.1
- instead of the current version 2.0.4
.
Just run ./gradlew app:dependencies
to see that it will resolve a different version.
Disclaimer: I'm not exactly sure why these dependencies are rather dated
... but generally one could exclude them, so that one has to provide them:
implementation ("com.google.android.material:material:1.3.0") {
exclude group: "androidx.annotation" // 1.0.1 < 1.1.0
exclude group: "androidx.appcompat" // 1.1.0 < 1.2.0
exclude group: "androidx.constraintlayout" // 2.0.1 < 2.0.4
exclude group: "androidx.core" // 1.2.0 < 1.3.2
exclude group: "androidx.fragment" // 1.0.0 < 1.3.0
exclude group: "androidx.lifecycle" // 2.0.0 < 2.3.0
exclude group: "androidx.recyclerview" // 1.0.0 < 1.1.0
exclude group: "androidx.transition" // 1.2.0 < 1.4.0
}
implementation "androidx.annotation:annotation:1.1.0"
implementation "androidx.appcompat:appcompat:1.2.0"
implementation "androidx.constraintlayout:constraintlayout:2.0.4"
implementation "androidx.core:core:1.3.2"
implementation "androidx.fragment:fragment:1.3.0"
implementation "androidx.lifecycle:lifecycle-runtime:2.3.0"
implementation "androidx.recyclerview:recyclerview:1.1.0"
implementation "androidx.transition:transition:1.4.0"
That's at least what Maven Central says; I'm assuming no side-effects.