android清单合并失败,gms播放服务/ firebase

fog*_*ogx 21 android android-manifest firebase firebaseui

我正在尝试使用firebaseUI将firebase添加到我的应用程序.作为本细则说,我已经使用了相应的GMS:播放服务(11.0.4)与firebaseUI版本(2.2.0) 当我在同步的gradle文件,我收到以下错误:

Error:Execution failed for task ':app:processDebugManifest'.
> Manifest merger failed : Attribute meta-data#android.support.VERSION@value value=(26.0.0) from [com.android.support:support-v13:26.0.0] AndroidManifest.xml:28:13-35
    is also present at [com.android.support:customtabs:25.4.0] AndroidManifest.xml:25:13-35 value=(25.4.0).
    Suggestion: add 'tools:replace="android:value"' to <meta-data> element at AndroidManifest.xml:26:9-28:38 to override.
Run Code Online (Sandbox Code Playgroud)

这是我的gradle文件:

android {
compileSdkVersion 26
buildToolsVersion "26.0.1"
defaultConfig {
    applicationId "com.test.test"
    minSdkVersion 21
    targetSdkVersion 25
    versionCode 1
    versionName "1.0"
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])


compile 'com.android.support:appcompat-v7:26.0.0'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.android.support:cardview-v7:26.0.0'
compile 'com.android.support:support-v13:26.0.0'
compile 'com.android.support:design:26.0.0'
compile 'com.android.support:recyclerview-v7:26.0.0'

//firebase
compile 'com.google.android.gms:play-services-auth:11.0.4'
compile 'com.google.firebase:firebase-core:11.0.4'
compile 'com.google.firebase:firebase-auth:11.0.4'
compile 'com.google.firebase:firebase-database:11.0.4'
compile 'com.google.firebase:firebase-storage:11.0.4'
compile 'com.firebaseui:firebase-ui:2.2.0'

testCompile 'junit:junit:4.12'
}

//firebase
apply plugin: 'com.google.gms.google-services'
Run Code Online (Sandbox Code Playgroud)

我确保所有版本都是最新的,并且它们都是一样的.无法弄清楚问题是什么?

fog*_*ogx 47

我通过添加以下内容解决了问题

    configurations.all {
    resolutionStrategy.eachDependency { DependencyResolveDetails details ->
        def requested = details.requested
        if (requested.group == 'com.android.support') {
            if (!requested.name.startsWith("multidex")) {
                details.useVersion '26.0.0'
            }
        }
    }
}
Run Code Online (Sandbox Code Playgroud)

从这里.

工具提示建议添加工具:replace ="android:value"'到元数据,但是这会引发另一个错误,所以我顺便提一下上面的解决方案

  • 但是在哪里添加这个 (2认同)

Moh*_*far 23

我通过在最底部AndroidManifest.xml<application>标签中添加它来解决它:

<meta-data 
  tools:node="replace"
  android:name="android.support.VERSION"
  android:value="26.1.0"  // <- The max version you see in the error message. For me it was 26.1.0
/>
Run Code Online (Sandbox Code Playgroud)

然后将这两个属性添加到<manifest ... >标记:

xmlns:tools="http://schemas.android.com/tools"
tools:node="replace"
Run Code Online (Sandbox Code Playgroud)


Swe*_*zra 17

它正在发生,因为两个版本的支持库发生冲突.最重要的是,你宣布了

buildToolsVersion "26.0.1"
Run Code Online (Sandbox Code Playgroud)

在依赖项中,版本是26.0.0

compile 'com.android.support:design:26.0.0'
Run Code Online (Sandbox Code Playgroud)

只需将支持库版本更改为26.0.1,它就可以正常工作.我做了同样的事,在我的情况下完美无瑕地工作.