如何同步gms和firebase的依赖关系

时间:2018-01-24 07:50:45

标签: android firebase

我是android新手所以请帮助我。

*Error:Execution failed for task ':app:processDebugGoogleServices'.
  

请修改版本冲突,方法是更新google-services插件的版本(https://bintray.com/android/android-tools/com.google.gms.google-services/提供有关最新版本的信息)或将com.google.android.gms版本更新为11.0.4 *。   这是代码

dependencies {
    implementation 'com.android.support.constraint:constraint-layout:1.0.2'
    implementation 'com.google.firebase:firebase-auth:11.8.0'//show red underline at this line
    implementation 'com.google.android.gms:play-services-maps:11.8.0'
    implementation 'com.android.support:appcompat-v7:26.1.0'//show red underline at this line
    compile fileTree(dir: 'libs', include: ['*.jar'])
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    //compile 'com.android.support:appcompat-v7:26.0.0-alpha1'

    compile 'com.android.support:design:26.0.0-alpha1'
    compile 'com.google.firebase:firebase-auth:11.0.4'
    compile 'com.google.firebase:firebase-database:11.0.4'
    testCompile 'junit:junit:4.12'
}
apply plugin: 'com.google.gms.google-services'

2 个答案:

答案 0 :(得分:0)

依赖于com.android.supportcom.google.firebase更新您的版本,如下所示:和同步项目。

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'com.android.support:appcompat-v7:26.1.0'
    implementation 'com.android.support:design:26.1.0' // update version
    implementation 'com.android.support.constraint:constraint-layout:1.0.2'
    implementation 'com.google.firebase:firebase-auth:11.8.0' // remove duplicate entry with other version
    implementation 'com.google.firebase:firebase-database:11.8.0' // update version

    implementation 'com.google.android.gms:play-services-maps:11.8.0'


    androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })

    testImplementation 'junit:junit:4.12'
}

答案 1 :(得分:-1)

implementation 'com.google.firebase:firebase-auth:11.8.0' //在此行显示红色下划线

implementation 'com.google.android.gms:play-services-maps:11.8.0'

11.8.0 更新为 11.0.4

  

确保所有库具有相同的值11.8.0