Firebase 不工作 com.google.firebase.installations.FirebaseInstallationsException

Jee*_*eva 32 android firebase

我正在开发一个 Android 应用程序,我想将应用程序移动到一个新的 firebase 项目,所以我删除了旧的 firebase 项目并创建了一个新的项目,然后我将我的应用程序添加到该项目中。在那之后,没有 Firebase 功能在工作。

我的应用程序中有 firebase 云消息传递,它正在工作,但现在无法工作,我没有收到FirebaseMessagingService$onNewToken,而且我正在firestore用作我的后端数据库。在我里面我.addOnSuccessListener得到0取回文件。它没有失败,但没有返回任何文件。

我认为可能是 firebase 的问题,所以我在其中创建了一个测试应用程序,node.js并尝试从中获取文档firestore它工作正常。

android 应用程序没有崩溃,但检查了错误日志,我看到了以下日志。

java.util.concurrent.ExecutionException: com.google.firebase.installations.FirebaseInstallationsException
        at com.google.android.gms.tasks.Tasks.zzb(Unknown Source:61)
        at com.google.android.gms.tasks.Tasks.await(Unknown Source:23)
        at com.google.firebase.iid.zzs.zzb(com.google.firebase:firebase-iid@@20.1.1:54)
        at com.google.firebase.iid.zzs.zza(com.google.firebase:firebase-iid@@20.1.1:89)
        at com.google.firebase.iid.zzv.run(Unknown Source:12)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
        at java.lang.Thread.run(Thread.java:764)
     Caused by: com.google.firebase.installations.FirebaseInstallationsException
        at com.google.firebase.installations.FirebaseInstallations.doRegistrationInternal(com.google.firebase:firebase-installations@@16.0.0:333)
        at com.google.firebase.installations.FirebaseInstallations.doGetId(com.google.firebase:firebase-installations@@16.0.0:280)
        at com.google.firebase.installations.FirebaseInstallations.access$lambda$0(Unknown Source:0)
        at com.google.firebase.installations.FirebaseInstallations$$Lambda$1.run(Unknown Source:2)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167) 
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641) 
        at java.lang.Thread.run(Thread.java:764) 
2020-03-05 21:18:49.022 23658-23666/app.spidy.cyberwire E/spidy.cyberwir: Something went wrong getting fds from adb. Retry!: Success
2020-03-05 21:20:11.198 23658-24183/app.spidy.cyberwire E/FirebaseInstanceId: Failed to get FIS auth token
    java.util.concurrent.ExecutionException: com.google.firebase.installations.FirebaseInstallationsException
        at com.google.android.gms.tasks.Tasks.zzb(Unknown Source:61)
        at com.google.android.gms.tasks.Tasks.await(Unknown Source:23)
        at com.google.firebase.iid.zzs.zzb(com.google.firebase:firebase-iid@@20.1.1:54)
        at com.google.firebase.iid.zzs.zza(com.google.firebase:firebase-iid@@20.1.1:89)
        at com.google.firebase.iid.zzv.run(Unknown Source:12)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
        at java.lang.Thread.run(Thread.java:764)
     Caused by: com.google.firebase.installations.FirebaseInstallationsException
        at com.google.firebase.installations.FirebaseInstallations.doRegistrationInternal(com.google.firebase:firebase-installations@@16.0.0:333)
        at com.google.firebase.installations.FirebaseInstallations.doGetId(com.google.firebase:firebase-installations@@16.0.0:280)
        at com.google.firebase.installations.FirebaseInstallations.access$lambda$0(Unknown Source:0)
        at com.google.firebase.installations.FirebaseInstallations$$Lambda$1.run(Unknown Source:2)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167) 
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641) 
        at java.lang.Thread.run(Thread.java:764) 
2020-03-05 21:22:41.287 23658-24278/app.spidy.cyberwire E/FirebaseInstanceId: Failed to get FIS auth token
    java.util.concurrent.ExecutionException: com.google.firebase.installations.FirebaseInstallationsException
        at com.google.android.gms.tasks.Tasks.zzb(Unknown Source:61)
        at com.google.android.gms.tasks.Tasks.await(Unknown Source:23)
        at com.google.firebase.iid.zzs.zzb(com.google.firebase:firebase-iid@@20.1.1:54)
        at com.google.firebase.iid.zzs.zza(com.google.firebase:firebase-iid@@20.1.1:89)
        at com.google.firebase.iid.zzv.run(Unknown Source:12)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
        at java.lang.Thread.run(Thread.java:764)
     Caused by: com.google.firebase.installations.FirebaseInstallationsException
        at com.google.firebase.installations.FirebaseInstallations.doRegistrationInternal(com.google.firebase:firebase-installations@@16.0.0:333)
        at com.google.firebase.installations.FirebaseInstallations.doGetId(com.google.firebase:firebase-installations@@16.0.0:280)
        at com.google.firebase.installations.FirebaseInstallations.access$lambda$0(Unknown Source:0)
        at com.google.firebase.installations.FirebaseInstallations$$Lambda$1.run(Unknown Source:2)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167) 
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641) 
        at java.lang.Thread.run(Thread.java:764) 
2020-03-05 21:27:11.330 23658-24399/app.spidy.cyberwire E/FirebaseInstanceId: Failed to get FIS auth token
    java.util.concurrent.ExecutionException: com.google.firebase.installations.FirebaseInstallationsException
        at com.google.android.gms.tasks.Tasks.zzb(Unknown Source:61)
        at com.google.android.gms.tasks.Tasks.await(Unknown Source:23)
        at com.google.firebase.iid.zzs.zzb(com.google.firebase:firebase-iid@@20.1.1:54)
        at com.google.firebase.iid.zzs.zza(com.google.firebase:firebase-iid@@20.1.1:89)
        at com.google.firebase.iid.zzv.run(Unknown Source:12)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
        at java.lang.Thread.run(Thread.java:764)
     Caused by: com.google.firebase.installations.FirebaseInstallationsException
        at com.google.firebase.installations.FirebaseInstallations.doRegistrationInternal(com.google.firebase:firebase-installations@@16.0.0:333)
        at com.google.firebase.installations.FirebaseInstallations.doGetId(com.google.firebase:firebase-installations@@16.0.0:280)
        at com.google.firebase.installations.FirebaseInstallations.access$lambda$0(Unknown Source:0)
        at com.google.firebase.installations.FirebaseInstallations$$Lambda$1.run(Unknown Source:2)
Run Code Online (Sandbox Code Playgroud)

Jee*_*eva 76

如果您最近更改了google-services.json文件,则只需build从 android 项目中删除文件夹并重新构建您的项目。

  • 救命恩人!谢谢! (2认同)

Luk*_*vak 14

我在firebase-messaging版本20.1.120.1.2. 我已经通过降级解决了20.1.0.

根据发行说明, Firebase 团队似乎对这些版本存在一些问题: Warning: The following two library versions released with this update have known issues and should not be used: firebase-messaging v20.1.1 and firebase-iid v20.1.0.


And*_*iep 11

Firebase Android SDK于 2 月 27 日(M65)更新,随后引入了一项新的基础设施服务,即 Firebase Installations SDK,它依赖于Firebase Installations API
Firebase 安装需要有效的 Firebase 选项API keyproject IDapplication ID(又名“ appId”)才能与 Firebase 服务器成功通信。

与 Firebase Installations API 通信期间的错误表明 Firebase 选项无效或有关 API 密钥的配置错误。

为了缓解这个问题

  • 确保您的应用程序使用google-services.json来自 Firebase 控制台的最新文件中的有效 Firebase 选项: Firebase 选项:说明和背景
  • 如果您使用 API 限制,请确保您的应用程序使用的 API 密钥已列入 Firebase Installations API(以及您的应用程序)的白名单: API 限制:说明和背景
  • 关于Application restrictions:将单选按钮设置为None或确保您的应用程序已列入白名单(使用正确的SHA-1 certificate)。

详情请访问:https :
//firebase.google.com/support/privacy/init-options


Dan*_*iil 10

我遇到了同样的问题,因为无法访问互联网(wifi 和手机)


Phi*_* D. 6

我遇到了同样的问题,就我而言,我的 Android 模拟器没有添加 Google Play 服务。使用 Google Play 服务创建了一个新服务,并且成功了。


Mah*_*rus 6

导致上述错误的原因可能有多种。我遇到的问题是由于SHA-1 证书指纹限制造成的。由于限制,Android商店构建中面临上述问题。

避免此错误的步骤。

  • 将 SHA-1 证书指纹添加到 firebase 项目设置中
  • 还要在 Google Cloud Console 中添加相同的 SHA-1 证书指纹。

将 SHA-1 证书指纹添加到 Google Cloud Console 的步骤:

  • 打开 Google Cloud Console 并选择您的项目
  • 单击 API 和服务选项卡
  • 然后选择信用证
  • 然后转到API部分
  • 最后,检查您的 SHA-1 密钥是否已添加到“限制使用您的 Android 应用程序”部分。如果没有添加包名称和 SHA-1 密钥。