清单合并错误 - 支持库的不同版本

时间:2017-07-22 01:38:28

标签: java android android-studio gradle dependencies

我将步进器指示器库 - https://github.com/badoualy/stepper-indicator - 添加到我的项目中。为此,我将jitpack添加到我的项目gradle文件中,并将stepper-indicator库添加到我的app gradle文件中。但是,我收到以下构建错误:

Error:Execution failed for task ':app:processDebugManifest'.
> Manifest merger failed : Attribute meta-data#android.support.VERSION@value value=(25.4.0) from [com.android.support:preference-v14:25.4.0] AndroidManifest.xml:25:13-35
    is also present at [com.android.support:appcompat-v7:26.0.0-beta2] AndroidManifest.xml:28:13-41 value=(26.0.0-beta2).
    Suggestion: add 'tools:replace="android:value"' to <meta-data> element at AndroidManifest.xml:23:9-25:38 to override.

我的应用中的其他依赖项包括:

compile 'com.android.support:preference-v7:25.4.0'
compile 'com.android.support:preference-v14:25.4.0'
compile 'eu.davidea:flexible-adapter:5.0.0-rc2'
compile 'com.android.support:appcompat-v7:25.4.0'
compile 'com.android.support:recyclerview-v7:25.4.0'
compile 'com.android.support:cardview-v7:25.4.0'
compile 'com.android.support:support-v4:25.4.0'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.google.android.gms:play-services-gcm:11.0.2'
compile 'com.google.android.gms:play-services-auth:11.0.2'
compile 'com.google.android.gms:play-services-ads:11.0.2'
compile 'com.google.firebase:firebase-messaging:11.0.2'
compile 'com.google.firebase:firebase-auth:11.0.2'
compile 'com.squareup.okhttp3:okhttp:3.8.1'

如果没有将所有Android支持库升级到alpha版本,是否有解决此问题的方法?

1 个答案:

答案 0 :(得分:7)

build.gradle中,您可以排除冲突的依赖项。例如:

compile ('com.github.badoualy:stepper-indicator:1.0.7'){ 
    exclude group: 'com.android.support', module: 'appcompat-v7' 
}

要检查依赖项,您可以在Android Studio中使用Gradle工具栏 - &gt;应用程序模块 - &gt;任务 - &gt; android - &gt; androidDependencies

更新

enter image description here