Firebase token retrieval failed on Android emulator

10,857 views
Skip to first unread message

Burak Malkoc

unread,
Jan 5, 2021, 5:15:42 AM1/5/21
to Firebase Google Group
Upgraded the firebase-messaging integration from 17.3.4 to firebase-bom:26.1.1 with com.google.firebase:firebase-messaging-ktx included. Within the setup token retrieval process is working on a real device however can not retrieve the token on emulator and receiving this error. Any idea how to get this work?

E/FirebaseInstanceId: Failed to get FIS auth token
    java.util.concurrent.ExecutionException: com.google.firebase.installations.FirebaseInstallationsException: Firebase Installations Service is unavailable. Please try again later.
        at com.google.android.gms.tasks.Tasks.zza(com.google.android.gms:play-services-tasks@@17.2.0:69)
        at com.google.android.gms.tasks.Tasks.await(com.google.android.gms:play-services-tasks@@17.2.0:23)
        at com.google.firebase.iid.GmsRpc.setDefaultAttributesToBundle(com.google.firebase:firebase-iid@@21.0.0:55)
        at com.google.firebase.iid.GmsRpc.startRpc(com.google.firebase:firebase-iid@@21.0.0:37)
        at com.google.firebase.iid.GmsRpc.getToken(com.google.firebase:firebase-iid@@21.0.0:13)
        at com.google.firebase.iid.FirebaseInstanceId.lambda$getInstanceId$1$FirebaseInstanceId(com.google.firebase:firebase-iid@@21.0.0:158)
        at com.google.firebase.iid.FirebaseInstanceId$$Lambda$3.start(Unknown Source:8)
        at com.google.firebase.iid.RequestDeduplicator.getOrStartGetTokenRequest(com.google.firebase:firebase-iid@@21.0.0:14)
        at com.google.firebase.iid.FirebaseInstanceId.lambda$getInstanceId$2$FirebaseInstanceId(com.google.firebase:firebase-iid@@21.0.0:157)
        at com.google.firebase.iid.FirebaseInstanceId$$Lambda$0.then(Unknown Source:6)
        at com.google.android.gms.tasks.zzf.run(com.google.android.gms:play-services-tasks@@17.2.0:2)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
        at com.google.android.gms.common.util.concurrent.zza.run(com.google.android.gms:play-services-basement@@17.5.0:6)
        at java.lang.Thread.run(Thread.java:919)
     Caused by: com.google.firebase.installations.FirebaseInstallationsException: Firebase Installations Service is unavailable. Please try again later.
        at com.google.firebase.installations.remote.FirebaseInstallationServiceClient.createFirebaseInstallation(FirebaseInstallationServiceClient.java:200)
        at com.google.firebase.installations.FirebaseInstallations.registerFidWithServer(FirebaseInstallations.java:490)
        at com.google.firebase.installations.FirebaseInstallations.doNetworkCallIfNecessary(FirebaseInstallations.java:361)
        at com.google.firebase.installations.FirebaseInstallations.lambda$doRegistrationOrRefresh$2(FirebaseInstallations.java:351)
        at com.google.firebase.installations.FirebaseInstallations$$Lambda$4.run(Unknown Source:4)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
        at java.lang.Thread.run(Thread.java:919) 


This email may contain material that is confidential and/or privileged for the sole use of the intended recipient. Any review, reliance, or distribution by others or forwarding without express permission is strictly prohibited. If you are not the intended recipient, please contact the sender and delete all copies. Also note that email is not an appropriate way to send protected health information to Omada Health employees. Please use your discretion when responding to this email.

Arthur Thompson

unread,
Jan 5, 2021, 10:42:22 AM1/5/21
to fireba...@googlegroups.com
Hi,

You should be able to get a token on an emulator. FCM will use the same services on the emulator as on the physical device so I'd expect it to work. Seems like the emulator is having trouble reaching the Firebase Installations service. Couple things to try:

- Uninstall and reinstall the app on the emulator
- Confirm that the emulator has network connectivity
- Restart the emulator



--
You received this message because you are subscribed to the Google Groups "Firebase Google Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to firebase-tal...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/firebase-talk/850e158a-857b-4ef0-936d-f24fcdbf4d2bn%40googlegroups.com.

Burak Malkoc

unread,
Jan 6, 2021, 5:23:09 AM1/6/21
to Firebase Google Group
Even tho I tried the steps above, nothing changed. 
So my current solution is changing emulator dns server to 8.8.8.8

./emulator @Pixel_4_API_30 -dns-server 8.8.8.8

Arthur Thompson

unread,
Jan 6, 2021, 12:50:06 PM1/6/21
to fireba...@googlegroups.com
Thanks for sharing your solution.

Arthur Thompson

unread,
Jan 6, 2021, 2:08:54 PM1/6/21
to fireba...@googlegroups.com
Hi Burak,

It seems strange that the emulator had connectivity but was unable to reach Firebase due to DNS.

Was there some DNS setup on the host machine that prevented the emulator from reaching Firebase?

Burak Malkoc

unread,
Jan 6, 2021, 7:13:56 PM1/6/21
to Firebase Google Group
Is there any firebase public ip addresses that I can ping to test out if the problem is really dns based?

Burak Malkoc

unread,
Jan 7, 2021, 3:14:24 PM1/7/21
to Firebase Google Group
After couple of restart of the Emulator, changing DNS is not a consistent solution.

Arthur Thompson

unread,
Jan 7, 2021, 3:17:16 PM1/7/21
to fireba...@googlegroups.com
I see; so even after resetting DNS your emulator is still unable to receive tokens but is able to have other types of network access?

Burak Malkoc

unread,
Jan 8, 2021, 5:22:26 AM1/8/21
to Firebase Google Group
Yes indeed.

Arthur Thompson

unread,
Jan 8, 2021, 12:40:10 PM1/8/21
to fireba...@googlegroups.com
That is really strange, is your emulator able to use any other Firebase services like Auth, RTDB or Firestore? I'm trying to see if this is an FCM specific issue or more general.

Burak Malkoc

unread,
Jan 8, 2021, 7:26:52 PM1/8/21
to Firebase Google Group
Even tho I have started the emulator with DNS 8.8.8.8, when I trigger https://firebase.google.com/  on chrome, I get this cert issue and I can't get the token by seeing this error on app "FirebaseInstanceId: Failed to get FIS auth token" 
Might be related?
Screen Shot 2021-01-08 at 1.31.32 PM.png

Arthur Thompson

unread,
Jan 11, 2021, 12:35:23 PM1/11/21
to fireba...@googlegroups.com
Hi Burak,

It seems like there may be an issue with reaching Firebase on the whole from your emulator, so this is more a cert issue than an Instance ID or FIS auth token issue. I would suggest trying to get the emulator to reach firebase.google.com then the app's ability to get tokens should also be resolved.

Burak Malkoc

unread,
Jan 14, 2021, 5:33:27 AM1/14/21
to Firebase Google Group
It turns out that, if you have Netskope Client running in your computer, that blocks some google services so results with FIS Auth error. Disabling Netskope works it out.
Thanks for your support

Arthur Thompson

unread,
Jan 14, 2021, 11:36:07 AM1/14/21
to fireba...@googlegroups.com
Hi Burak,

Thanks for sharing those findings. I'm sure it will be helpful to others.

Reply all
Reply to author
Forward
0 new messages