Missing api_key/current key with Google Services 3.0.0

后端 未结 17 869
小鲜肉
小鲜肉 2020-12-02 07:20

Since I upgraded the project with the latest version of google services and libraries (9.0.0), I have this strange issue :

Grade console :

:         


        
相关标签:
17条回答
  • 2020-12-02 08:02

    You need to add SHA certificate fingerprints to your project and then download the google-services.jason file again, which should contain "api_key": [{ "current_key": "xxxxxx" }] automatically.

    You can view following page to see how to generate the fingerprints:

    https://developers.google.com/android/guides/client-auth

    On windows, just execute following command, and use android as password for debug purpose:

    keytool -exportcert -list -v -alias androiddebugkey -keystore %USERPROFILE%\.android\debug.keystore
    
    0 讨论(0)
  • 2020-12-02 08:07

    For firebase migrators:

    make sure you have added at least one Fingerprint in your project settings and re-download the google-services.json file

    0 讨论(0)
  • 2020-12-02 08:09

    Although Jozka Jozin's accepted answer and its comments, Cloud Messaging is neither related nor required.

    Nevertheless, re-generating google-services.json is the key to solution (so I voted him). Below is what I did:

    As you know you can generate the config file for Analytics from the Google Developers Guide.

    1: Choose your app.

    2: Close the popup! It hides...

    3: THE OPTION OF ADMOB!

    4: Of course, select and enable it!

    5: Now we can rightly generate configuration files!

    6: We made it! This time, the configuration file should include the api_key appropriately.

    Conclusion: The UI of the interactive generation tool is a bit confusing...

    0 讨论(0)
  • 2020-12-02 08:10

    If you are using firebaes, you have to copy serverKey from the firebase to the google-services.json

     "api_key": [{ "current_key": "SERVER_KEY"}
    

    To get the server Key, Goto ProjectOverview> Project Settings > CloudMessaging > Copy OR generate and copy serverKey..

    0 讨论(0)
  • 2020-12-02 08:11

    regenerate google-services.json at https://developers.google.com/cloud-messaging/android/client#get-config,one important thing is that you must enable Cloud Messaging in "Choose services" step ,open the new google-services.json file you will see words like

        "api_key": [
         {
           "current_key": "xxxxxxxxxxx"
         }"
    

    without this words or without value of current_key is not the right file

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