Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to generate google-services.json for existing Google Android project?

In the following website, when registering for Android GCM: https://developers.google.com/mobile/add?platform=android&cntapi=signin&cntapp=Default%20Demo%20App&cntpkg=com.google.samples.quickstart.signin&cnturl=https:%2F%2Fdevelopers.google.com%2Fidentity%2Fsign-in%2Fandroid%2Fstart%3Fconfigured%3Dtrue&cntlbl=Continue%20with%20Try%20Sign-In

The google-services.json file is generated here. This is required on the client side.

How can we generate this file for existing Google Android project?

like image 863
code Avatar asked Jan 15 '16 17:01

code


People also ask

Where is Google services json Android project?

Adding the JSON File The google-services. json file is generally placed in the app/ directory (at the root of the Android Studio app module).

How can I add two Google services json in the same project?

There is no way to use two google-services. json files in a single Android app. The file name is the same between them and they need to be in the same location. So one will overwrite the other in that case.


1 Answers

I had this same problem today, very frustrating, but I finally found something that worked for me.

The problem with the page you referenced is that your existing projects do not show up in the "Create or Choose an App" dropdown. I had this same issue, even when it showed that I was logged into my google developer account.

I think there is a problem with the session on this page, so it doesn't load your projects. I was able to get it to work when accessing the page through the console help feature.

This is how I did it. It seems illogical, but stick with me:

  1. Sign out of google developer console
  2. Sign in to https://console.cloud.google.com/home/dashboard
  3. In the top blue bar, "select a project" dropdown, select the project for which you want to generate the json file.
  4. In the top blue bar, click the Help icon. A Console Help feature will pop up.
  5. Type "google-services.json" into the Help feature search bar and press enter.

  6. Click on the help item titled "Set up a GCM Client App on Android"

Now, this is where it starts to seem illogical, because you're going to go to the same pages that didn't work for you before, but stick with me.

  1. Scroll down the page a bit and click the blue "GET A CONFIGURATION FILE" button.

This button is going to take you to the exact same page you referenced in your question. However, your list of current apps should appear in the "Create or Choose and App" dropdown.

This worked for me, I hope it works for you.

WARNING: When I did this, it changed my API Key. My project number and other info stayed the same, but my API Key changed. So if you have projects that depend on your existing API key, you'll have to deal with the consequenses.

like image 108
James Wiley Avatar answered Oct 13 '22 05:10

James Wiley