首页 > 解决方案 > Gradle 依赖冲突解决:

问题描述

我有以下 gradle 冲突。

Conflict with dependency 'net.danlew:android.joda' in project ':app'. Resolved versions for runtime classpath (2.10.1) and compile classpath (2.7.2) differ. This can lead to runtime crashes. To resolve this issue follow advice at https://developer.android.com/studio/build/gradle-tips#configure-project-wide-properties. Alternatively, you can try to fix the problem by adding this snippet to C:\Users\...\Documents\...\..\..\build.gradle:

我用来解决此问题的解决方案如下:

configurations.all {
    resolutionStrategy.eachDependency { details ->
        if (details.requested.group == 'net.danlew:android.joda'
                && !details.requested.name.contains('joda') ) {
            details.useVersion "2.7.2"
        }
    }
}

这是解决依赖冲突的最理想方法吗?

标签: androidgradledependencies

解决方案


推荐阅读