Android Studio 3和Gradle 3.0.0-依赖项具有不同的编译和运行时类路径版本 [英] Android studio 3 and Gradle 3.0.0 - Dependency has different version for compile and runtime classpath

查看:55
本文介绍了Android Studio 3和Gradle 3.0.0-依赖项具有不同的编译和运行时类路径版本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

更新到Gradle版本3.0.0和Android Studio 3.0后,我收到以下错误:

After updating to Gradle version 3.0.0 and Android Studio 3.0 I'm receiving the following error:

错误:任务':app:appNameDebugBuild'的执行失败.

Error:Execution failed for task ':app:appNameDebugBuild'.

Android依赖项'com.android.support:recyclerview-v7'对于编译(24.0.0)和运行时(25.4.0)具有不同的版本类路径.您应该通过以下方式手动设置相同的版本DependencyResolution

Android dependency 'com.android.support:recyclerview-v7' has different version for the compile (24.0.0) and runtime (25.4.0) classpath. You should manually set the same version via DependencyResolution

我确实在项目中搜索了版本为24.0.0的任何内容,但未找到任何内容.在gradle上,我定义了一个版本为25.4.0的变量,并将其用于 compile/implementation 依赖项.

I did search for anything with the version 24.0.0 in my project but didnt find anything. On gradle I define a variable with the version 25.4.0 and use it on compile/implementation dependencies.

如何检查哪个库或模块正在使用版本24.0.0?我该如何解决?

How can I check which library or module is using the version 24.0.0? How can i work around this?

推荐答案

尝试将此子项目块添加到主/顶级gradle文件中.清理并重新构建.

Try adding this subprojects block to your main/top level gradle file. Clean and Build again.

allprojects {
    repositories {
       //...
    }

    subprojects {
        project.configurations.all {
            resolutionStrategy.eachDependency { details ->
                if (details.requested.group == 'com.android.support'
                && !details.requested.name.contains('multidex') ) {
                    details.useVersion "25.4.0"
                }
            }
        }
    }
}

这篇关于Android Studio 3和Gradle 3.0.0-依赖项具有不同的编译和运行时类路径版本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆