FirebaseRemoteConfig 错误 "No value of type 'String' exists for parameter key"

FirebaseRemoteConfig Error "No value of type 'String' exists for parameter key"

我正在使用 Firebase Core 和其他一些功能,但没有使用远程配置。以下输出每秒多次打开 Logcat。

在哪里可以禁用远程配置功能甚至设置那些不存在的值?

依赖关系:

// Project
classpath 'com.android.tools.build:gradle:3.2.1'
classpath 'com.google.gms:google-services:4.2.0'
classpath 'com.google.firebase:firebase-plugins:1.2.0'

classpath 'io.fabric.tools:gradle:1.26.1'

// Module
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support:design:28.0.0'
implementation 'com.android.support:support-v4:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.android.support:support-vector-drawable:28.0.0'
implementation 'com.android.support:preference-v7:28.0.0'
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support:recyclerview-v7:28.0.0'
implementation 'com.android.support:design:28.0.0'
implementation 'org.jsoup:jsoup:1.11.3'
implementation 'com.squareup.okhttp3:okhttp:3.11.0'
implementation 'com.android.support:cardview-v7:28.0.0'

implementation 'com.google.firebase:firebase-core:16.0.8'
implementation 'com.google.firebase:firebase-messaging:17.5.0'
implementation 'com.google.firebase:firebase-perf:16.2.4'
implementation 'com.google.android.gms:play-services-location:16.0.0'
implementation 'com.jsibbold:zoomage:1.2.0'
implementation 'com.android.support:exifinterface:28.0.0'
implementation 'com.squareup.picasso:picasso:2.71828'

implementation 'com.crashlytics.sdk.android:crashlytics:2.9.9'
W/FirebaseRemoteConfig: No value of type 'String' exists for parameter key 'sessions_max_length_minutes'.
W/FirebaseRemoteConfig: No value of type 'String' exists for parameter key 'sessions_max_length_minutes'.
W/FirebaseRemoteConfig: No value of type 'String' exists for parameter key 'sessions_feature_enabled'.
W/FirebaseRemoteConfig: No value of type 'String' exists for parameter key 'sessions_max_length_minutes'.
W/FirebaseRemoteConfig: No value of type 'String' exists for parameter key 'fpr_vc_trace_sampling_rate'.
W/FirebaseRemoteConfig: No value of type 'String' exists for parameter key 'sessions_feature_enabled'.
W/FirebaseRemoteConfig: No value of type 'String' exists for parameter key 'fpr_vc_trace_sampling_rate'.

我认为它不会引起任何问题,只是烦人的是它会向控制台发送垃圾邮件。

Firebase 性能监控在内部使用 Firebase 远程配置。您无法更改输出,但可以 send feedback to the team 使用我在上面评论中提供的 link。

它来自 firebase-perf 的最新版本(例如 16.2.5),因为它具有内部 firebase-remote-config 依赖性。 我有同样的问题,但我不知道如何正确修复此日志垃圾邮件(logcat 中的“像这样折叠行”选项除外)。 希望 Firebase 团队尽快修复它。

如果您使用 Firebase 控制台,在“远程配置”选项卡中设置这两个值将停止警告。

我使用过:(作为字符串值)

  • 参数键:sessions_max_length_minutes |值:“15”
  • 参数键:sessions_feature_enabled |值:"true"

不确定是否有任何副作用,但(希望如此)这是一个内部测试,不会改变任何东西。

Firebase 对我的错误报告的回答:

您似乎收到了一些关于远程配置的警告。我们设法在我们这边重现,我们的工程师已经确认这是按预期工作的。发生这种情况是因为您的应用程序中添加了性能监控 SDK。这是因为性能监控在内部使用 Firebase 远程配置。但是,我们的工程师已经确认他们将在未来尝试减少这些警告。目前,您可以忽略这些,因为它只是一个警告,不会影响应用程序的性能。

这可能与以下因素有关或由以下因素引起:

W/zzd: Application name is not set. Call Builder#setApplicationName

禁用 perf-plugin & firebase-perf 删除烦人的日志条目:

// classpath "com.google.firebase:perf-plugin:1.2.1"
// apply plugin: "com.google.firebase.firebase-perf"
// implementation "com.google.firebase:firebase-perf:17.0.0"

firebase-config 独立运行良好。

The Firebase Android library firebase-core is no longer needed. This SDK included the Firebase SDK for Google Analytics.

删除 build.gradle

中的 firebase-core

解决方案

Firebase Performance 上周发布了 19.0.8 版本以解决垃圾日志问题。 (请参阅发行说明 https://firebase.google.com/support/release-notes/android#2020-07-17)您可以将依赖项 com.google.firebase:firebase-perf 更新为相同或更高版本以验证修复。


说明

详细解释此问题的原因:Firebase Performance 利用 Firebase Remote Config 对发送到的事件数量进行采样Firebase,因此它会在每次需要采样配置值时调用 Firebase Remote Config API getValue(String key)

但是,Firebase 远程配置提取每 12 小时发生一次。到开发时,配置值可能不存在。在这种情况下,Firebase Performance SDK 将使用 默认值

当配置值不存在时,Firebase Remote Config会生成此日志进行警告,这是Firebase Performance用户的垃圾日志来源。 (参见 Source Code

我们已将 Firebase Performance 的调用频率降低到 Firebase Remote Config 以避免触发此日志。

这是我的观察:

如果您在 RemoteConfig 控制台 上设置了特定的 key 并且没有在默认 xml 中添加 default 密钥(传入 setDefaultsAsync()).

如果,对于某些罕见的情况,
要么是没有连接,要么是 Firebase RemoteConfig 无法获取值,如果那个特定的 key 被用来获取默认值,
您可能会在 Logcat.

中收到该消息