Android Error when communicating with the Firebase Installations server API

后端 未结 9 1570
死守一世寂寞
死守一世寂寞 2020-12-17 15:44

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

W/Firebase-Installations: Error when communicating with the Firebase Installations server API.         


        
相关标签:
9条回答
  • 2020-12-17 16:23

    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!

    0 讨论(0)
  • 2020-12-17 16:24

    I encountered with this error when initializing new app so it may not solve your issue since you say your app is existing but I hope it helps.

    I've created new SHA Key for SHA-1 fingerprint of keystore certificate (both for debug and signing! only signing didn't work)

    and I've added them into my firebase settings (below my package name careful if you have multiple). Now it works for me.

    0 讨论(0)
  • 2020-12-17 16:27

    If you have issues with your API key, you can create a new API key in the Cloud Console:

    • go to the Google Cloud Console
    • choose the relevant project (i.e. the project you use for your application)
    • open the menu and go to APIs & ServicesCredentials
    • on top of the page click on + CREATE CREDENTIALSAPI key
    • replace the API key in your application with the newly created API key

    In case you are using the google-services.json config file from your Firebase Console, you first have to delete or restrict the API key used in your current google-services.json in order to make Firebase update config file and use a new API key.

    • Identify the API key in your google-services.json config file.
    • Confirm that the API key is creating the erroneous requests by checking its usage against the Firebase Installations API metrics page. The column Usage with this service of your API key should show a number greater than 0.
    • Delete that API key by clicking the bin symbol or add Application restrictions to that API key by clicking the pencil symbol. !!Warning!! Do not delete an API key that existing installations of your applications require for other Firebase services like Firebase Auth or Realtime-Database.

    Wait a couple of minutes for Google servers to update. The next download of your google-service.json config file should contain a new API key.

    You can test your configuration with the following CURL command. What is the error you are getting? (Note: If you are seeing JSON data the request was and your configuration is successful)


    Test if your configuration works with the following CURL command:

    api_key=<YOUR_API_KEY>;
    project_identifier=<YOUR_PROJECT_ID>;
    app_id=<YOUR_FIREBASE_APP_ID_EXAMPLE_1:12345678:android:00000aaaaaaaa>;
    
    curl -H "content-type: application/json" -d "{appId: '$app_id', sdkVersion: 't:1'}" https://firebaseinstallations.googleapis.com/v1/projects/$project_identifier/installations/?key=$api_key;
    

    Other relevant links regarding API keys and the Firebase Installations API:

    • https://firebase.google.com/support/privacy/init-options
    • https://github.com/firebase/firebase-android-sdk/blob/master/firebase-installations/API_KEY_RESTRICTIONS.md
    • https://firebase.google.com/support/release-notes/android#2020-02-27
    • https://github.com/firebase/firebase-android-sdk/blob/master/firebase-installations/REQUIRED_FIREBASE_OPTIONS_ANDROID.md
    0 讨论(0)
  • 2020-12-17 16:27

    I had the same issue. Please find the following steps i followed to resolve this.

    1. Navigate to the google project and make sure your app sha1 key is configured properly.
    2. Download the google-services.json file from the project and make sure it is same as the one exists in the android project
    3. Clean the project to remove all build configurations generated previously.
    4. Build the app
    0 讨论(0)
  • 2020-12-17 16:28

    It turned out that the issue was with the version of firebase-messaging for me, using this version in app gradle got rid of the error:

    implementation "com.google.firebase:firebase-messaging:20.1.0"
    
    0 讨论(0)
  • 2020-12-17 16:31

    This error could happen if you include in gradle some firebase modules that not configured properly (analytics, storage, messaging etc.)

    0 讨论(0)
提交回复
热议问题