How to manually generates google-services.json

Viewed 2872

I am trying to add google-services.json to the project. in Android studio, i navigated to 'project' view and i added 'google-services.json' to 'app' directory. Then, I opened 'google-services.json' file and the only change i t did to it, is adding the project's package name in 'package_name' attribute in 'client' object as shown in google-services.json.

And according to link-1 below, it says:

The main result of the JSON processing is to produce two XML files which you can reference as Android resources in your Java code... in

app/build/generated/res/google-services/{build_type}/values/values.xml

AND.

app/build/generated/res/google-services/{flavor}/{build_type}/xml/global_tracker.xml

but in my case, i got only one .xml file as shown in image-1 below. However, as stated in link-1, one can generates these files manually by creating a .xml file.

I referred to link-1 to know the required values -please have a look at image-2-I tried to generate it but I could not find the values marked with ??????. please have a look at missing-values-file below.

1- please let me know how to find these missing values marked with ??????? in missing-values-file?

2- what is the purpose of server API key and Sender id generated by GCM? why they are not used in the file posted in the section missing-values-file

link-1: here.

**link-2: the configuration file was downloaded from here **

google-services.json: the values that contain 'x' are actually existing but i removed them for security

{
"project_info": {
"project_number": "119xxx",
"project_id": "defxxx"
},
"client": [
{
  "client_info": {
    "mobilesdk_app_id": "1:1xxx",
    "android_client_info": {
      "package_name": "eu.xxx"
    }
  },
  "oauth_client": [
    {
      "client_id": "119xxx",
      "client_type": 3
    }
  ],
  "api_key": [
    {
      "current_key": "AIzxxx"
    }
  ],
  "services": {
    "analytics_service": {
      "status": 1
    },
    "appinvite_service": {
      "status": 1,
      "other_platform_oauth_client": []
    },
    "ads_service": {
      "status": 1
    }
  }
}
],
"configuration_version": "1"
}

image-1:

enter image description here

missing-values-file:

<?xml version="1.0" encoding="utf-8"?>
<resources>

<! -- Present in all applications -->
<string name="google_app_id" translatable="false">1:1xxx</string>

<! -- Present in applications with the appropriate services configured -->
<string name="gcm_defaultSenderId" translatable="false">119xxx</string>
<string name="default_web_client_id" translatable="false">119xxxx</string>
<string name="ga_trackingId" translatable="false">??????</string>
<string name="firebase_database_url" translatable="false">???????</string>
<string name="google_api_key" translatable="false">???????</string>
<string name="google_crash_reporting_api_key" translatable="false">???????</string>

</resources>

image-2

The required values

enter image description here

1 Answers
Related