从 gradle 中排除 constraintlayout 依赖
Exclude constraintlayout dependency from gradle
我正在使用 StripeSDK
,我想排除嵌入其 SDK
中的约束布局库。如何排除 constraintlayout 被合并到我的应用程序中?我使用的是稍旧的版本,升级导致视觉故障。
我试过了:
implementation ('com.stripe:stripe-android:16.10.0') {
exclude group: 'androidx.constraintlayout:constraintlayout'
}
也尝试过:
implementation ('com.stripe:stripe-android:16.10.0') {
exclude group: 'androidx.constraintlayout:constraintlayout' module:'app'
}
我相信对此的答案不是排除该组,而是按照此答案中的描述强制使用您想要使用的版本:
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.
我正在使用 StripeSDK
,我想排除嵌入其 SDK
中的约束布局库。如何排除 constraintlayout 被合并到我的应用程序中?我使用的是稍旧的版本,升级导致视觉故障。
我试过了:
implementation ('com.stripe:stripe-android:16.10.0') {
exclude group: 'androidx.constraintlayout:constraintlayout'
}
也尝试过:
implementation ('com.stripe:stripe-android:16.10.0') {
exclude group: 'androidx.constraintlayout:constraintlayout' module:'app'
}
我相信对此的答案不是排除该组,而是按照此答案中的描述强制使用您想要使用的版本:
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
andjackson-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.