0

I am using the StripeSDK, and I want to exclude the constraintlayout library that is embedded within their SDK. How can I exclude the constraintlayout from being merged into my app? I am using a slightly older version, and upgrading is causing a visual glitch.

I tried:

implementation ('com.stripe:stripe-android:16.10.0') {
    exclude group: 'androidx.constraintlayout:constraintlayout'
}

also tried:

implementation ('com.stripe:stripe-android:16.10.0') {
    exclude group: 'androidx.constraintlayout:constraintlayout' module:'app'
}
elena.kim
  • 930
  • 4
  • 12
  • 22
Chrystian
  • 977
  • 3
  • 11
  • 24

1 Answers1

1

I believe the answer to this is not to exclude the group, but to force the version you want to use as described in this answer: https://stackoverflow.com/a/62278010/1076562

When Gradle encounters two different versions of the same dependency, it will perform a conflict resolution. It defaults to choosing the highest version number.

However, because many libraries like Jackson consists of a number of individual modules like jackson-databind and jackson-core, you may end up in a situation where there is a mismatch between the different versions.

To align them, you can use the Jackson BOM and Gradle's platform dependency mechanism. It looks like this (choose only one of the depencendies below):

dependencies {
    // Enforce the specified version  
    implementation(enforcedPlatform("com.fasterxml.jackson:jackson-bom:2.10.4"))

    // Align all modules to the same version, but allow upgrade to a higher version  
    implementation(platform("com.fasterxml.jackson:jackson-bom:2.10.4"))
}

You don't need to exclude anything from your other dependencies.

Justin Michael
  • 5,634
  • 1
  • 29
  • 32