【发布时间】:2021-01-21 08:48:33
【问题描述】:
我为已经使用 firebase crashlytics 和 firebase analytics 的旧应用程序实现了 firebase 远程配置。这些服务运行良好。但是使用远程配置时,我收到此身份验证令牌错误。
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);
}
}
我正在主屏幕片段中使用获取请求。我在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 方面做任何其他配置吗?
【问题讨论】:
-
查看最后的@franvis 评论 -> github.com/firebase/firebase-android-sdk/issues/1776.
-
您最近更改了 google-services.json 吗?
-
请告诉我 - 您找到解决问题的方法了吗?迁移到 Firebase BoM(版本为 27.0.0)后,我面临完全相同的问题
标签: android firebase-remote-config