java 无法解析符号“FirebaseInstanceId”
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/49129901/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Cannot resolve symbol "FirebaseInstanceId"
提问by wazzaday
I am trying to use FirebaseInstanceId but keep getting the error
我正在尝试使用 FirebaseInstanceId 但不断收到错误
"Cannot resolve symbol FirebaseInstanceId".
“无法解析符号 FirebaseInstanceId”。
The modules gradle includes
模块gradle包括
dependencies {
compile 'com.google.firebase:firebase-messaging:+'
compile 'com.google.firebase:firebase-iid:+'
}
The only thing which exists on com.google.firebase.iid seems to be .zzb. Am I missing something?
com.google.firebase.iid 上唯一存在的似乎是 .zzb。我错过了什么吗?
采纳答案by Santanu Sur
Make sure you have all of these
确保您拥有所有这些
implementation 'com.google.firebase:firebase-core:17.2.1'
implementation 'com.google.firebase:firebase-messaging:20.0.0'
implementation 'com.google.firebase:firebase-auth:19.1.0' // not necessary(required for signout and sign in)
Just this much is required.
只需要这么多。
回答by Umar Hussain
Only use the dependency firebase-messaging
with firebase-core
仅使用依赖firebase-messaging
与firebase-core
firebase-iid is not required to be declared as dependency.
firebase-iid 不需要声明为依赖项。
Here is the documentation : https://firebase.google.com/docs/cloud-messaging/android/client#set-up-firebase-and-the-fcm-sdk
这是文档:https: //firebase.google.com/docs/cloud-messaging/android/client#set-up-firebase-and-the-fcm-sdk