按照以下步骤连接到Firebase后,应用程序级别gradle同步失败

时间:2018-10-19 06:05:25

标签: android firebase android-studio

dependencies {
 implementation fileTree(dir: 'libs', include: ['*.jar'])
 implementation 'com.android.support:appcompat-v7:27.1.1'
 implementation 'com.android.support.constraint:constraint-layout:1.1.3'
 testImplementation 'junit:junit:4.12'
 androidTestImplementation 'com.android.support.test:runner:1.0.2'
 androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
 implementation 'com.google.firebase:firebase-core:16.0.1'
}

原因错误:

implementation 'com.android.support:appcompat-v7:27.1.1'
same version specification (mixing versions can lead to runtime crashes)
says "All com.android.support libraries must use the exact same version specification (mixing versions can lead to runtime crashes). Found versions 27.1.1, 26.1.0. Examples include com.android.support:animated-vector-drawable:27.1.1 and com.android.support:support-media-compat:26.1.0"

1 个答案:

答案 0 :(得分:0)

您必须在依赖项块之后添加它

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

它将消除此错误!