Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Error when communicating with the Firebase Installations server API

I am getting an Error Message on App Startup Stating Logs like

W/Firebase-Installations: Error when communicating with the Firebase Installations server API. HTTP response: [400 Bad Request: {   "error": {     "code": 400,     "message": "API key not valid. Please pass a valid API key.",     "status": "INVALID_ARGUMENT",     "details": [       {         "@type": "type.googleapis.com/google.rpc.Help",         "links": [           {             "description": "Google developers console",             "url": "https://console.developers.google.com"           }         ]       }     ]   } } ] 2020-04-27 12:42:34.621 22226-23596/in.co.androidapp.g7 E/Firebase-Installations: Firebase Installations can not communicate with Firebase server APIs due to invalid configuration. Please update your Firebase initialization process and set valid Firebase options (API key, Project ID, Application ID) when initializing Firebase. 

I got an email about a week earlier that I should update my google_services.json File, which I have done 4-5 times. No Improvements. It had been working fine for around a year. Its been only 2-3 days since I am facing this issue in the app.

Subsequently, Firebase Cloud Messaging and other firebase services are not working. I am not doing programmatic initialization (that is, using a FirebaseOptions object to provide these values), just the default initialization using FirebaseApp.initializeApp(this);

I have tried https://github.com/firebase/firebase-android-sdk/blob/master/firebase-installations/API_KEY_RESTRICTIONS.md

Thanks in Advance.

like image 624
Daksh Agrawal Avatar asked Apr 27 '20 07:04

Daksh Agrawal


People also ask

Why is my android studio not connecting to firebase?

Just sign out your gmail account from Android Studio and then re-sign in again. After this, try again connecting to the firebase. It should connect!

What is firebase installations API?

The Firebase installations service: provides a unique identifier for a Firebase installation. provides an auth token for a Firebase installation. provides a API to perform GDPR-compliant deletion of a Firebase installation.

How do I find my firebase Web API key?

You can open the project in the firebase, then you should click on the project overview, then goto project settings you will see the web API Key there.


1 Answers

I had this same issue. I solved it by the following way.

go to app/build/generated/res/google-services/debug/values/values.xml

Here you can find your old API key.

Replace both google_api_key and google_crash_reporting_api_key values with the new one that you can find from the google-services.json file. it will be under api-key array.

Cheers!

like image 187
Abhijith Brumal Avatar answered Sep 21 '22 11:09

Abhijith Brumal