问题
I'm trying to set up my production application to use remote config, but I'm getting a FirebaseRemoteConfigFetchException. This project is already deployed, we use FCM, Crashlytics and Dynamic Links. If I use the dev project on firebase everything work just fine. So I don't think it's the google-service.json configuration. The only difference between the configurations is in the production instance I have the SHA certificate fingerprint setup.
2019-02-08 22:59:52.755 19724-19744/? W/System.err: java.io.IOException: com.google.android.gms.internal.firebase_remote_config.zzas.read() returned value out of range -1..255: -117 2019-02-08 22:59:52.755 19724-19744/? W/System.err: at java.util.zip.GZIPInputStream.readUByte(GZIPInputStream.java:273) 2019-02-08 22:59:52.755 19724-19744/? W/System.err: at java.util.zip.GZIPInputStream.readUShort(GZIPInputStream.java:260) 2019-02-08 22:59:52.755 19724-19744/? W/System.err: at java.util.zip.GZIPInputStream.readHeader(GZIPInputStream.java:165) 2019-02-08 22:59:52.755 19724-19744/? W/System.err: at java.util.zip.GZIPInputStream.(GZIPInputStream.java:80) 2019-02-08 22:59:52.755 19724-19744/? W/System.err: at java.util.zip.GZIPInputStream.(GZIPInputStream.java:92) 2019-02-08 22:59:52.756 19724-19744/? W/System.err: at com.google.android.gms.internal.firebase_remote_config.zzad.getContent(Unknown Source:46) 2019-02-08 22:59:52.756 19724-19744/? W/System.err: at com.google.android.gms.internal.firebase_remote_config.zzd.zza(Unknown Source:12) 2019-02-08 22:59:52.756 19724-19744/? W/System.err: at com.google.android.gms.internal.firebase_remote_config.zzm.zza(Unknown Source:14) 2019-02-08 22:59:52.756 19724-19744/? W/System.err: at com.google.android.gms.internal.firebase_remote_config.zzg.zzb(Unknown Source:5) 2019-02-08 22:59:52.756 19724-19744/? W/System.err: at com.google.android.gms.internal.firebase_remote_config.zzaa.zzad(Unknown Source:178) 2019-02-08 22:59:52.756 19724-19744/? W/System.err: at com.google.android.gms.internal.firebase_remote_config.zzf.zzi(Unknown Source:51) 2019-02-08 22:59:52.757 19724-19744/? W/System.err: at com.google.android.gms.internal.firebase_remote_config.zzer.zzc(Unknown Source:41) 2019-02-08 22:59:52.757 19724-19744/? W/System.err: at com.google.android.gms.internal.firebase_remote_config.zzer.zzb(Unknown Source:23) 2019-02-08 22:59:52.757 19724-19744/? W/System.err: at com.google.android.gms.internal.firebase_remote_config.zzer.zza(Unknown Source:149) 2019-02-08 22:59:52.757 19724-19744/? W/System.err: at com.google.android.gms.internal.firebase_remote_config.zzes.then(Unknown Source:6) 2019-02-08 22:59:52.757 19724-19744/? W/System.err: at com.google.android.gms.tasks.zzf.run(Unknown Source:2) 2019-02-08 22:59:52.757 19724-19744/? W/System.err: at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162) 2019-02-08 22:59:52.757 19724-19744/? W/System.err: at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636) 2019-02-08 22:59:52.757 19724-19744/? W/System.err: at java.lang.Thread.run(Thread.java:764) 2019-02-08 22:59:52.757 19724-19744/? E/FirebaseRemoteConfig: Fetch failed! Server responded with an error. com.google.android.gms.internal.firebase_remote_config.zzd: 403 Forbidden at com.google.android.gms.internal.firebase_remote_config.zzm.zza(Unknown Source:14) at com.google.android.gms.internal.firebase_remote_config.zzg.zzb(Unknown Source:5) at com.google.android.gms.internal.firebase_remote_config.zzaa.zzad(Unknown Source:178) at com.google.android.gms.internal.firebase_remote_config.zzf.zzi(Unknown Source:51) at com.google.android.gms.internal.firebase_remote_config.zzer.zzc(Unknown Source:41) at com.google.android.gms.internal.firebase_remote_config.zzer.zzb(Unknown Source:23) at com.google.android.gms.internal.firebase_remote_config.zzer.zza(Unknown Source:149) at com.google.android.gms.internal.firebase_remote_config.zzes.then(Unknown Source:6) at com.google.android.gms.tasks.zzf.run(Unknown Source:2) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636) at java.lang.Thread.run(Thread.java:764) 2019-02-08 22:59:52.759 19724-19754/? E/FirebaseRemoteConfig: Fetch failed! com.google.firebase.remoteconfig.FirebaseRemoteConfigFetchException: Fetch failed: The user is not authorized to access the project. Please make sure you are using the API key that corresponds to your Firebase project. Check logs for details. at com.google.android.gms.internal.firebase_remote_config.zzer.zzc(Unknown Source:77) at com.google.android.gms.internal.firebase_remote_config.zzer.zzb(Unknown Source:23) at com.google.android.gms.internal.firebase_remote_config.zzer.zza(Unknown Source:149) at com.google.android.gms.internal.firebase_remote_config.zzes.then(Unknown Source:6) at com.google.android.gms.tasks.zzf.run(Unknown Source:2) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636) at java.lang.Thread.run(Thread.java:764)
回答1:
After digging a little bit, and looking all over the place, I found that for some reason I had to go to https://console.developers.google.com -> Enable API and Services -> Firebase Remote Config, and enable that API. After doing that everything started to work again.
I hope this helps someone in the future, cheers!
来源:https://stackoverflow.com/questions/54603283/firebase-remote-config-fetch-failed-with-user-not-authorized