Android依赖项'com.android.support:appcompat-v7'具有不同版本的编译

时间:2018-04-08 20:42:12

标签: android gradle android-appcompat

我已升级到Android Studio 3.1和Gradle 4.4以及sdk工具27。

现在我收到以下错误:

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

我甚至不知道从哪里开始找到解决方案。请帮忙。

1 个答案:

答案 0 :(得分:0)

通过为项目运行正确的gradle -q依赖项命令,您应该能够确切地看到奇数版本中的哪个依赖项作为传递依赖项:

[https://docs.gradle.org/current/userguide/userguide_single.html#sec:listing_dependencies][1]

一旦你追踪了什么,你就可以在你的gradle文件中添加一个排除到特定的依赖项,例如:

implementation("XXXXX") {
    exclude group: 'com.android.support', module: 'support-compat'
}

示例:

dependencies {
    implementation('log4j:log4j:1.2.15') {
        exclude group: 'javax.jms', module: 'jms'
        exclude group: 'com.sun.jdmk', module: 'jmxtools'
        exclude group: 'com.sun.jmx', module: 'jmxri'
    }
}
相关问题