Firebase assistants error: Failed to resolve: fire

2019-08-27 18:47发布

问题:

I am currently facing the error when i try to connect to the Cloud Messaging using firebase assistants.

Failed to resolve: firebase-messaging-15.0.0

I search online, and the solution was to remove the last few digits in the dependency. However, when i tried that, it solved the error, but on the firebase assistants, it did not show "dependency being set up correctly" anymore. Hence, does this mean that i am not connected to the firebase cloud messaging?

Method tried: change from implementation 'com.google.firebase:firebase-messaging:17.0.0:15.0.0' to implementation 'com.google.firebase:firebase-messaging:17.0.0'

The dependency being set up correctly is in green before i use the online method of removing the last few digits of the dependency

回答1:

You are getting the following error:

Failed to resolve: firebase-messaging-15.0.0

Because you are using a wrong dependency in your code. To solve this, please change the following line of code:

implementation 'com.google.firebase:firebase-messaging:17.0.0:15.0.0'

to

implementation 'com.google.firebase:firebase-messaging:17.3.4'

Because such a version 17.0.0:15.0.0 does not exist. Here you can find more informations.

In your top level build.gradle file please be sure to have the latest version of Google Service plugin and Gradle:

classpath 'com.android.tools.build:gradle:3.2.1'
classpath 'com.google.gms:google-services:4.2.0'


回答2:

remove all firebase-messaging dependency and add This Dependency

implementation 'com.google.firebase:firebase-messaging:17.0.0'