Using GMS and Firebase 9.0.2
I set up my app with Firebase, features like Analytics or Notifications are already working. Now I tried to add Remote Config but every time I call fetch, I get a com.google.firebase.remoteconfig.FirebaseRemoteConfigFetchException.
I'm not doing anything special. Basicly, all I do is
FirebaseRemoteConfig.getInstance().fetch().addOnCompleteListener {
toast(it.isSuccessful.toString())
it.exception?.printStackTrace()
}
in my main activity's onCreate method (nevermind the Kotlin syntax) and every time I get
com.google.firebase.remoteconfig.FirebaseRemoteConfigFetchException
at com.google.firebase.remoteconfig.FirebaseRemoteConfig.zza(Unknown Source)
at com.google.firebase.remoteconfig.FirebaseRemoteConfig$1.zza(Unknown Source)
at com.google.firebase.remoteconfig.FirebaseRemoteConfig$1.onResult(Unknown Source)
at com.google.android.gms.internal.zznv$zza.zzb(Unknown Source)
at com.google.android.gms.internal.zznv$zza.handleMessage(Unknown Source)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5417)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
@cypressious can you try printing the Exception message?
@samtstern this is what I got:
com.google.firebase.remoteconfig.FirebaseRemoteConfigFetchException
at com.google.firebase.remoteconfig.FirebaseRemoteConfig.zza(Unknown Source)
at com.google.firebase.remoteconfig.FirebaseRemoteConfig$1.zza(Unknown Source)
at com.google.firebase.remoteconfig.FirebaseRemoteConfig$1.onResult(Unknown Source)
at com.google.android.gms.internal.zznv$zza.zzb(Unknown Source)
at com.google.android.gms.internal.zznv$zza.handleMessage(Unknown Source)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.os.HandlerThread.run(HandlerThread.java:61)
there is no visible error message
Same here :confused:
Exception message is null
any news on this?
this is what I get
I had the same problem. As in your code, I was calling fetch() without a parameter, but it was resolved when I passed in the cacheExpiration parameter as noted in the example:
long cacheExpiration = 3600; // 1 hour in seconds.
if (mFirebaseRemoteConfig.getInfo().getConfigSettings().isDeveloperModeEnabled()) {
cacheExpiration = 0;
}
mFirebaseRemoteConfig.fetch(cacheExpiration)
Same issue here as well.
Is this issue still occurring on 9.2.0?
Seems to be fixed with 9.2.0
@cypressious thanks for the follow up!
this bug comeback on 9.4.0 version, here is my code
FirebaseRemoteConfigSettings configSettings = new FirebaseRemoteConfigSettings.Builder()
.setDeveloperModeEnabled(BuildConfig.DEBUG)
.build();
mFirebaseRemoteConfig = FirebaseRemoteConfig.getInstance();
mFirebaseRemoteConfig.setConfigSettings(configSettings);
long cacheExpiration = 43200L;
if (mFirebaseRemoteConfig.getInfo().getConfigSettings().isDeveloperModeEnabled()) {
cacheExpiration = 0;
}
mFirebaseRemoteConfig.fetch(cacheExpiration).addOnCompleteListener(new OnCompleteListener<Void>() {
@Override
public void onComplete(@NonNull Task<Void> task) {
if (task.isSuccessful()) {
Log.d("AppConfig","App config loaded");
// Once the config is successfully fetched it must be activated before newly fetched
// values are returned.
mFirebaseRemoteConfig.activateFetched();
} else {
Log.e("AppConfig","AppConfig failed to load");
}
}
});
here is stacktrace
com.learn.firebasedb10255-10255/com.learn.firebasedb W/System.err: com.google.firebase.remoteconfig.FirebaseRemoteConfigFetchException
com.learn.firebasedb10255-10255/com.learn.firebasedb W/System.err: at com.google.firebase.remoteconfig.FirebaseRemoteConfig.zza(Unknown Source)
com.learn.firebasedb10255-10255/com.learn.firebasedb W/System.err: at com.google.firebase.remoteconfig.FirebaseRemoteConfig$1.zza(Unknown Source)
com.learn.firebasedb10255-10255/com.learn.firebasedb W/System.err: at com.google.firebase.remoteconfig.FirebaseRemoteConfig$1.onResult(Unknown Source)
com.learn.firebasedb10255-10255/com.learn.firebasedb W/System.err: at com.google.android.gms.internal.zzpo$zza.zzb(Unknown Source)
com.learn.firebasedb10255-10255/com.learn.firebasedb W/System.err: at com.google.android.gms.internal.zzpo$zza.handleMessage(Unknown Source)
com.learn.firebasedb10255-10255/com.learn.firebasedb W/System.err: at android.os.Handler.dispatchMessage(Handler.java:102)
com.learn.firebasedb10255-10255/com.learn.firebasedb W/System.err: at android.os.Looper.loop(Looper.java:148)
com.learn.firebasedb10255-10255/com.learn.firebasedb W/System.err: at android.app.ActivityThread.main(ActivityThread.java:5417)
com.learn.firebasedb10255-10255/com.learn.firebasedb W/System.err: at java.lang.reflect.Method.invoke(Native Method)
com.learn.firebasedb10255-10255/com.learn.firebasedb W/System.err: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
com.learn.firebasedb10255-10255/com.learn.firebasedb W/System.err: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
task.getException().getMessage() return null.
with or without expiration parameter while fetch, this error still occur.
please fix/give me solution. thanks.
@isapoetra are you calling fetch in your Activity's onCreate method?
@samtstern yes. any suggestion?
I am having the exact same problem. This issue was closed with problems still existing it seems. Is anyone still having this problem? Has anyone figured out how to resolve it?
I'm still getting this issue as well, using 10.2.0 Always comes back with a fetch exception with no detail message. Makes no difference whether I use a cache expiration parameter or not in the fetch call.
I have the similar issue with 10.2.4, but without exception, just no callbacks called when fetching, the issue is only on specific device (Sony Xperia d5803 with Android 4.4.4) and 100% reproducible, it doesn't work every time. Tried all workarounds available with delayed fetching, but nothing helped to fix the issue.
@Stepyon try reaching out to firebase support for help troubleshooting your particular issue.
Same issue with 10.2.4 and Android emulator Nexus 6 + API23.
Same here with 10.2.4 on two phones, Nexus 5 and Samsung S6.
The most annoying thing - there is no actual error message in the exception.
Cherry on top:
Same exact code works fine, no exceptions, fetch is successful on three other phones (Nexus 5x, Samsung S6, Huawei Honor).
Oh wait, just started failing on those three phones too the same way.
I have the same problem, 10.2.4 , emulator API 25 (not only)
After first application run, fetch() properly triggers addOnSuccessListener. When I stop (terminate, update, or re-run in Android Studio shift+f10) the app and reopen it, fetch starts to throw com.google.firebase.remoteconfig.FirebaseRemoteConfigFetchException
I tried different approaches:
Update:
The problem is with firebase server. The same application with different project in firebase console and different google-services.json works fine.
i had this problem, on Genymotion emulator Nexus 5, API 23 Marshmallow. my problem is fixed by installing google play services on the emulator device.
Many Android devices on the earth are shipped without Google Play services. That's where this issue happens. Your remote configuration could never reach these devices at present.
Firebase team should definitely make Remote Config work on wider devices, including those shipped without Google Play services. (e.g. Amazon Fire devices and most Android devices in China)
PS, Firebase Analytics, Realtime Database, Crashlytics already works without Google Play services.
Many Android devices on the earth are shipped without Google Play Services. That's where this issue happens.
My test devices, as mentioned above, were a Samsung, a Nexus, and a Huawei, all with Google Play Services. And so, assuming that this exception is caused by missing Google Play Services is just plain not true.
We ended up going with Google Tag Manager instead (which has its own bugs, including a tendency for thread deadlocks :) ) but it still works a lot better than Firebase.
For my case, like @oasisfeng said, it's was a problem of missing google services.
I work with a custom ROM without any google application, I use firebase services (it's work perfectly for analytics and Crashlytics), but not for remote-config and performance.
I fix my problem by using awesome project: opengapps. You can add google apps application by following the process on gapps for aosp
Now it works perfectly 馃憤
I have this problem in my application and even after catching the FirebaseRemoteConfigException the app still crashes
Hi all m for anyone still facing this issue , The Remote Config library has a client-side throttle to ensure you don鈥檛 ping the service too frequently. By setting your fetchDuration to 0, you鈥檒l hit this throttle and your library will stop making calls.
You can get around this by enabling developer mode.call this function right before you call Remote config API .
func activateDebugMode() {
let debugSettings = FIRRemoteConfigSettings(developerModeEnabled: true)
FIRRemoteConfig.remoteConfig().configSettings = debugSettings!
}
By setting developer mode to true, you鈥檙e telling Remote Config to bypass the client-side throttle. For development purposes, or testing with your 10-person team, this is fine. But if you were to launch this app to the public with your millions of adoring fans, you鈥檙e going to hit the server-side throttle pretty quickly, and Remote Config will stop working. (This is the whole reason you have a client-side throttle in the first place.)
For release mode make sure you disable developer mode and set your fetchDuration to something a little more reasonable, like 43200 (that鈥檚 12 hours to you and me).
Hope this helps !
Still an issue in Firebase Config 16.1. Nothing to do with throttling.
Think I have a workaround though.
My code was doing this:
firebaseRemoteConfig.activateFetched();
// Use firebaseRemoteConfig.getString / getAllKeys / etc.
firebaseRemoteConfig.fetch().addOnCompleteListener(callback)
// callback:
if (task.isSuccessful()) {
// Would not happen
} else {
// Would happen
final Exception x = task.getException();
// x = FirebaseRemoteConfigException
// x.getMessage = null
}
Makes sense right?
We may already have some values, we activate and use them, and then queue up a refresh in case there is an update.
This caused FirebaseRemoteConfigException every time.
And this is the workaround - how Firebase Config wants you to do things:
firebaseRemoteConfig.fetch().addOnCompleteListener(callback)
firebaseRemoteConfig.activateFetched();
// Use firebaseRemoteConfig.getString / getAllKeys / etc.
// Note that the fetch callback hasn't triggered yet
// callback:
if (task.isSuccessful()) {
// Now we end up here every time
} else {
// And this doesn't happen
final Exception x = task.getException();
}
I'm not sure if my "workaround" is actually how the API works and my older code is just wrong. I can't quite tell if we're supposed to / can call activateFetched "just in case" to activate "any just in case" previously fetched values.
I also can't quite tell if activateFetched is necessary at least once per app process lifetime to activate any values fetched (and cached in storage, I presume) on previous runs.
I also don't know if my fetch (in the "workaround" version) is actually completing before I'm calling activateFetched / getValue, so maybe I'm just getting lucky because my networking is fast.
But I hope my comment may help another developer.
It also seems to me that Firebase APIs (there are what, three methods total really?) are too fragile.
An application calling activateFetched when it's not needed should just be a no-op and not cause the whole technology piece fall go catatonic. Anyone from Google here who wants to take this up?
facing the same problem with 16.0.3. have anyone have got solution for this problem.
Just found out that the same exact exception could be thrown if you attach a proxy (i.e. Charles etc) in the middle of your app and the network. I hope that helps
Most helpful comment
I am having the exact same problem. This issue was closed with problems still existing it seems. Is anyone still having this problem? Has anyone figured out how to resolve it?