Masroor
Masroor

Reputation: 1604

FirebaseInstanceId Token retrieval failed SERVICE_NOT_AVAILABLE

I'm working on an android app, it uses Firebase Authentication, Database and Storage. It was all working fine until this error message started to show up in logcat. (I did not tamper with any configs at firebase console)

E/FirebaseInstanceId: Token retrieval failed: SERVICE_NOT_AVAILABLE

this error message shows even when I have commented on all firebase-related code.

Therefore I'm unable to proceed with authentication and other firebase-related stuff.
Yes, I'm connected to the internet and also have gotten a new Google-Services.json file from Firebase Console but it has made no difference at all.

Upvotes: 106

Views: 90052

Answers (13)

Mohi Dev
Mohi Dev

Reputation: 3406

The solution is so simple and You have to cold-boot your android emulator

Upvotes: 1

Tanveer Ahmad
Tanveer Ahmad

Reputation: 71

wipe android emulator data and than run emulator its work for me enter image description here

Upvotes: 1

Martin4code
Martin4code

Reputation: 99

Visual Studio 2022 menu:

  1. Tools
  2. Android
  3. Android Device Manager
  4. Select device and click Edit

enter image description here

Upvotes: 2

Akash Neeli
Akash Neeli

Reputation: 407

In my case, I was facing an Internet connectivity Issue. Make sure your Internet Connection is Strong enough to Generate FcmToken.

Upvotes: 4

MrPlow
MrPlow

Reputation: 1234

For me, this was a connection issue with my emulator. I was unable to load websites outside of my company's VPN. Probably worth confirming that you can do that (load up yahoo or stackoverflow on the device's browser) if you're having this issue. Once I figured out my emulator's connection issues, I was able to get the token.

Upvotes: 1

Navinpd
Navinpd

Reputation: 832

For future readers:

Found this error when I set device date different than current and open. My application logs start printing similar log. Solution: restart your device and it will start working fine.

Upvotes: 7

Anupam Haldkar
Anupam Haldkar

Reputation: 1085

Check that Google play services are enabled

if it still shows error Now try these steps

Step 1 - Stop emulator device

Step 2 - open AVD Manager Panel, edit device configuration. In device configuration panel "Show Advanced Settings" in "Emulated Performance" section select "Cold boot" option as Boot Option then click Finish, it should be worked.

If this does not work try to work on different Emulator

Upvotes: 5

Quang Le
Quang Le

Reputation: 351

Root cause: You miss google services in your device. So if you use emulator then apply "Cold boot" mode in advanced setting, if you use real device please change another enter image description here

Upvotes: 1

Manuel Mühlemann
Manuel Mühlemann

Reputation: 1051

"Cold Boot Now" Device in AVD Manager worked for me.

Edit: After updating emulators and than doing the cold boot it helped. – parohy Apr 5 at 9:22

Upvotes: 104

cowboycb
cowboycb

Reputation: 569

Stop emulator device and open AVD Manager Panel, edit device configuration. In device configuration panel "Show Advanced Settings" in "Emulated Performance" section select "Cold boot" option as Boot Option then click Finish, it should be worked.

enter image description here

Upvotes: 30

gabhor
gabhor

Reputation: 789

I also faced with this issue. As I can see it can happen for many reasons.

Finally I figured out that my problem was that the current latest Facebook Android SDK version (v4.36.0) has a bug. Everything works fine if I set it back to v4.35.0. Maybe this info can help someone in the future.

You can find here the releases: https://github.com/facebook/facebook-android-sdk/releases

Upvotes: 22

Mo Meshkani
Mo Meshkani

Reputation: 1694

I changed my emulator and now it is working correctly without any error.

Upvotes: 5

EdHuamani
EdHuamani

Reputation: 1897

you need to update the emulator to the latest version that includes Google Play services

Upvotes: 9

Related Questions