【问题标题】:Android Firebase Remote Config: Application name is not set. Call Builder#setApplicationNameAndroid Firebase 远程配置:未设置应用程序名称。调用 Builder#setApplicationName
【发布时间】:2019-02-19 12:46:56
【问题描述】:
每当我拨打FirebaseRemoteConfig.getInstance() 时,都会收到以下警告:
W/zze: Application name is not set. Call Builder#setApplicationName.
我已经从 Firebase 更新了 json 配置文件,但它保持不变。它不会影响任何功能,但我不禁认为缺少一些东西。我可能在某处缺少任何配置?
【问题讨论】:
-
我也收到了同样的警告(使用 RemoteConfig),我可以确认一切正常。我也在 Flutter repo issues 中找到了一些东西。我们可以跟进。
-
标签:
android
firebase
firebase-remote-config
【解决方案1】:
此警告已在firebase-config 19.0.2 中解决。
所以如果你把库升级到这个版本:
implementation 'com.google.firebase:firebase-config:19.0.2'
警告消失。
不管怎样,即使这个警告污染了我们的日志消息,使用以前版本的 firebase 配置的应用程序确实可以正常运行。
【解决方案2】:
这对我有用。
我使用 Flutter 项目
添加await remoteConfig.fetch(expiration: const Duration(seconds: 0)); 和await remoteConfig.activateFetched();
void _adminValidate() async {
try{
final RemoteConfig remoteConfig = await RemoteConfig.instance;
await remoteConfig.fetch(expiration: const Duration(seconds: 0));
await remoteConfig.activateFetched();
print(remoteConfig.getString('admin'));
}catch (e){
print(e);
}
}