Firebase更新后,Gradle同步失败

时间:2018-08-15 07:44:05

标签: android firebase android-gradle google-play-services build.gradle

从昨天(2018/08/14)开始,由于此错误,我无法进行任何更改(两天前工作正常)来构建我们的项目:

Failed to resolve: play-services-auth-base

因此,我进行了搜索,发现一些解决方案表明更新了Firebase依赖性以及类似内容。 我们更新了所有Google依赖项,但仍然出现错误。 这是我对Gradle的Google依赖:

//moudule level gradle

implementation 'com.google.firebase:firebase-auth:15.0.0'
implementation 'com.google.firebase:firebase-config:15.0.2'
implementation 'com.google.firebase:firebase-core:15.0.2'
implementation 'com.google.android.gms:play-services-auth:15.0.1'

//project level build.gradle

classpath 'com.android.tools.build:gradle:3.2.0-alpha18'
classpath 'com.google.gms:google-services:4.0.1'

更新为此:

implementation 'com.google.firebase:firebase-auth:16.0.3'
implementation 'com.google.firebase:firebase-config:16.0.0'
implementation 'com.google.firebase:firebase-core:16.0.1'
implementation 'com.google.android.gms:play-services-auth:16.0.0'

我收到此错误:

The library com.google.android.gms:play-services-measurement-base is being requested by various other libraries at [[15.0.4,15.0.4], [16.0.0,16.0.0]], but resolves to 16.0.0. Disable the plugin and check your dependencies tree using ./gradlew :app:dependencies.

Google更新了Firebase: Firebase Android Release Notes

出什么问题了?

2 个答案:

答案 0 :(得分:2)

就我而言,与Firebase版本和oneSignal库存在冲突: 将oneSignal的版本从0.8.1设置为0.11.2可以解决我的问题。

这些是firebase依赖项:

implementation 'com.google.firebase:firebase-auth:16.0.3'
implementation 'com.google.firebase:firebase-config:16.0.0'
implementation 'com.google.android.gms:play-services-auth:16.0.0'

就这样!

以下解决方案也可以正常工作!

像这样将依赖性版本设置为11.8.0:

implementation 'com.google.firebase:firebase-config:11.8.0'
implementation 'com.google.firebase:firebase-core:11.8.0'
implementation 'com.google.android.gms:play-services-auth:11.8.0'

然后删除/注释此行:

implementation 'com.google.firebase:firebase-auth ...

我发现这些依赖项之间存在冲突,原因是:传递性依赖项。

答案 1 :(得分:0)

步骤:1         classpath'com.google.gms:google-services:4.1.0'// google-services插件

步骤:2

allprojects存储库

    google() // Google's Maven repository