Firebase-android-sdk: Firebase remoteConfig return no value

Created on 19 Nov 2020  路  15Comments  路  Source: firebase/firebase-android-sdk

[REQUIRED] Step 2: Describe your environment

  • Android Studio version: 4.1.1
  • Firebase Component: firebase-config/firebase-config-ktx
  • Component version: 20.0.1

Hello everyone,

Since I've updated the component firebase-config from 20.0.0 to 20.0.1, I can't get values from Firebase.remoteConfig.

Nothing has changed in my code since previous version :

First I fetch and active in my MainActivity

val configSettings = remoteConfigSettings {
    minimumFetchIntervalInSeconds = 3600
}

Firebase.remoteConfig.setConfigSettingsAsync(configSettings)

Firebase.remoteConfig.fetchAndActivate().addOnCompleteListener(this) { task ->

    if (task.isComplete) {
        // Some code here
    }

}

And then in a fragment I get values :

with (Firebase.remoteConfig) {

    val a = getValue("key1").asString()
    val b = getValue("key2").asString()

}
remoteconfig

All 15 comments

I found a few problems with this issue:

  • I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight.
  • This issue does not seem to follow the issue template. Make sure you provide all the required information.

I have the same issue.
When updating the app to the new RemoteConfig version, no values are received anymore and the default values apply.
Reinstalling fixes the issue, but I cannot ask all my users to reinstall the app or clear data.

I've encountered the same issue. The value has been synced in previous remote config SDK version when it updated with the version of 20.0.1 the data was lost. Although can be resolved simply by staling the remote config this is not the convenient way I think.

This is reproducible, try to build with the version 19.2.0 everything is okay, then rebuild with the version 20.0.1 remote config return no value for the given key

@AgiMaulana Same here. And when downgrading to 20.0.0 it works fine again. I have downgraded RemoteConfig in my production apk again.

Looking into this. I'm unable to reproduce it in a new Kotlin app with firebase-config-ktx:20.0.1 and firebase-analytics-ktx:18.0.0 as dependencies. @vic-flair do you mind taking a look, too?

@danasilver I'm seeing the same as others have reported, with a firebase-config:20.0.x dependency and a firebase-analytics:18.0.0 dependency (transitively via firebase-core):

  1. Fresh install (via Android Studio, "Debug app") of app with a 20.0.0 dependency.
  2. Run app, correct remote config values are shown
  3. Stop app
  4. Update dependency to 20.0.1 and install.
  5. Run app, correct remote config values are not shown

If, between steps 3 and 4, I "clear data" for this app on the device, everything works correctly.

If, instead of clearing data, I set the device to airplane mode before steps 4/5, correct values are still not shown. Because of this, I believe the problematic part is not actually the fetching but the activating of a remote config that is already cached on the device.

Could the issue be ConfigStorageClient.read() (permalink below)?

It seems that, if a config was written to disk without personalization (version <20.0.1), then trying to read it **with** personalization (version =20.0.1) should lead to JSONObject.getJSONObject(key) being called with a key that doesn't exist via ConfigContainer.copyOf() and thus throwing a JSONException, which in turn makes the method return null.

https://github.com/firebase/firebase-android-sdk/blob/0fa174c6f55ece8f13b87c1765522f87db3510f6/firebase-config/src/main/java/com/google/firebase/remoteconfig/internal/ConfigStorageClient.java#L105

@bocops Thanks for the help investigating. I'm able to reproduce the issue now with those steps. It does seem like the issue is reading the cached config. Working on a fix for this.

This issue is really scary.
Can we expect a fixed version ASAP?

Now that Firebase is recommending BoM (Bills of Materials) for adding dependencies, I don't want to specify an older version explicitly just for Remote Config.

For everyone who has shipped the remote config 20.0.1 within your production app and already implemented propagating realtime update, you can to try propagate realtime update to stale the local config so the app can rewrite local config with a new one using the new writing scheme.

I've fix the issue on production app using that workaround

We have had the same issue and fixed by noticing when the app has been updated and calling FirebaseRemoteConfig.getInstance().reset(), which has fixed the issue for us.

Remote Config SDK version 20.0.2 is live now with a fix. A new version of the Firebase BOM (26.1.1) has been released, too, including this version.

Thanks all for your help reporting and investigating the issue!

Was this bug impacting the Flutter version?

@XinyueZ I don't think this affected Flutter since it looks like the Flutter SDK is using Firebase Android BOM 25.12.0 and this issue was in version 26.1.0 of the BOM. It's fixed in version 26.1.1.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

lamba92 picture lamba92  路  3Comments

quiro91 picture quiro91  路  5Comments

wangjiejacques picture wangjiejacques  路  5Comments

Belka1000867 picture Belka1000867  路  3Comments

AyatKhraisat picture AyatKhraisat  路  6Comments