gpt4 book ai didi

android - Firebase 远程配置获取失败,出现 FirebaseRemoteConfigClientException

转载 作者:行者123 更新时间:2023-12-05 04:54:13 31 4
gpt4 key购买 nike

我为已经使用 firebase crashlytics 和 firebase analytics 的旧应用程序实现了 firebase 远程配置。这些服务运行良好。但是通过远程配置我得到了这个授权 token 错误。

com.google.firebase.remoteconfig.FirebaseRemoteConfigClientException: Firebase Installations failed to get installation auth token for fetch.
at com.google.firebase.remoteconfig.internal.ConfigFetchHandler.lambda$fetchIfCacheExpiredAndNotThrottled$1(ConfigFetchHandler.java:209)
at com.google.firebase.remoteconfig.internal.ConfigFetchHandler$$Lambda$2.then(Unknown Source:8)
at com.google.android.gms.tasks.zzg.run(com.google.android.gms:play-services-tasks@@17.0.2: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:919)
Caused by: com.google.firebase.installations.FirebaseInstallationsException: Firebase Installations Service is unavailable. Please try again later.
at com.google.firebase.installations.remote.FirebaseInstallationServiceClient.createFirebaseInstallation(FirebaseInstallationServiceClient.java:147)
at com.google.firebase.installations.FirebaseInstallations.registerFidWithServer(FirebaseInstallations.java:490)
at com.google.firebase.installations.FirebaseInstallations.doNetworkCallIfNecessary(FirebaseInstallations.java:361)
at com.google.firebase.installations.FirebaseInstallations.lambda$doRegistrationOrRefresh$2(FirebaseInstallations.java:351)
at com.google.firebase.installations.FirebaseInstallations$$Lambda$4.run(Unknown Source:4)

我遵循了谷歌文档中的实现指南。我不确定我是否错过了任何步骤。这是我的代码。

应用类

public class Global extends Application {

public static FirebaseRemoteConfig REMOTE_CONFIG = null;

@Override
public void onCreate() {
super.onCreate();

REMOTE_CONFIG = FirebaseRemoteConfig.getInstance();
FirebaseRemoteConfigSettings configSettings = new FirebaseRemoteConfigSettings.Builder()
.setMinimumFetchIntervalInSeconds(3600)
.build();
REMOTE_CONFIG.setConfigSettingsAsync(configSettings);
REMOTE_CONFIG.setDefaultsAsync(R.xml.remote_config_defaults);
}
}

我在主屏幕 fragment 中使用获取请求。我在 onViewCreated

中调用以下方法
private void getRemoteConfig(){

Global.REMOTE_CONFIG.fetchAndActivate().addOnCompleteListener(requireActivity(), task -> {

if (task.isSuccessful()) {
String home_screen_status = Global.REMOTE_CONFIG.getString("home_screen_status");
}else{
try {
throw task.getException();
} catch (Exception e) {
e.printStackTrace();
}
}
});
}

有人可以指出我缺少什么吗?在 firebase 方面,我是否还需要做任何其他我缺少的配置?

最佳答案

正如您在错误日志的第 8 行中看到的那样

Caused by: com.google.firebase.installations.FirebaseInstallationsException: Firebase Installations Service is unavailable. Please try again later.

所以你可以尝试两件事:

  1. 尝试添加 SHA 证书指纹 如果您还没有这样做,然后 Invalidate 和重建您的项目。
  2. 或者您可以简单地删除 build 文件,然后重新构建您的项目。

关于android - Firebase 远程配置获取失败,出现 FirebaseRemoteConfigClientException,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/65823846/

31 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com