无法解析“:app @ debug / compileClasspath”的依赖项:无法解析com.google.firebase:firebase-messaging:17.1.0

无法解析“:app @ debug / compileClasspath”的依赖项:无法解析com.google.firebase:firebase-messaging:17.1.0

问题描述:

当前,我正在开发一个android聊天应用程序。我想在我的应用程序中添加FCM。但是我总是收到这个gradle错误。根据我的阅读,firebase auth,数据库和消息传递依赖项版本应该匹配。我已经尝试了每个版本,但仍然会发生相同的错误。

Currently, I am working on an android chat application. I want to add FCM in my app. But I am always getting this gradle error. From what I have read, the firebase auth, database and messaging dependency version should match. I have tried every version, still, the same error occurs.

要解决此问题,请更改以下代码行:

To solve this, please change the following line of code:

com.google.firebase:firebase-auth:16.0.1

com.google.firebase:firebase-auth:16.0.2

并添加:

com.google.firebase:firebase-core:16.0.1

现在强制执行。也不要忘记添加:

Which is mandatory now. Don't also forget to add:

apply plugin: 'com.google.gms.google-services'

在文件末尾和以下代码行:

At the end of your file and the following line of code:

classpath 'com.google.gms:google-services:4.0.2'

放入您的 build.gradle 文件(项目)。

Into your build.gradle file (Project).

PS。如果您使用的是Firebase-UI身份验证,请同时添加以下代码行:

PS. If you are using Firebase-UI auth, add also this line of code:

com.firebaseui:firebase-ui-auth:4.0.1