如何解决FirebaseRemoteConfigClientException:Firebase 安装无法获取安装身份验证令牌以进行提取
我收到异常
com.google.firebase.remoteconfig.FirebaseRemoteConfigClientException: Firebase Installations failed to get installation auth token for fetch.
谁能告诉我我的代码有什么问题? 我已经像这样初始化了远程配置
val firebaseRemoteConfig: FirebaseRemoteConfig by lazy { FirebaseRemoteConfig.getInstance() }
val firebaseRemoteConfigSettings = FirebaseRemoteConfigSettings.Builder()
.setMinimumFetchIntervalInSeconds(0)
.build()
firebaseRemoteConfig.setConfigSettingsAsync(firebaseRemoteConfigSettings)
firebaseRemoteConfig.setDefaultsAsync(configDefault)
if (NetworkConnectionHelper().connectionStatus(context)) {
firebaseRemoteConfig.fetchAndActivate()
.addOnCompleteListener { task: Task<Boolean?> ->
if (task.isSuccessful) {
setup()
Utils.log("remoteConfig Success.")
} else {
Utils.log("remoteConfig failed.")
setup()
}
}
.addOnFailureListener { exception -> Utils.log("remoteConfig exception: $exception") }
.addOnCanceledListener { Utils.log("remoteConfig initAssetList: cancelled ") }
} else {
setup()
}
到目前为止我尝试过的
- 我已将 SHA1 密钥添加到 Google Api 和服务的“限制使用您的 Android 应用”部分下
- 卸载并安装应用。
- 在 Firebase 控制台中添加了 SHA1 密钥。
- 仅尝试使用 remoteconfig 的“fetch()”方法而不是 fetchAndActivie()。
但没有任何帮助,我无法从远程配置中获取值。
解决方法
最后我花了一整天才发现错误,是我在 Google 的 api 和服务门户中添加 SHA-1 时在包名称中拼写错误。 还是谢谢。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。