Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to add google-services.json in Android?

The error is:

File google-services.json is missing from module root folder. The Google Quickstart Plugin cannot function without it.

like image 490
Lalit Kushwah Avatar asked Aug 18 '15 12:08

Lalit Kushwah


People also ask

Where do I put Google-services json?

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

Where do I put Google-services json Flutter?

Once your Android app has been registered, download the configuration file from the Firebase Console (the file is called google-services. json ). Add this file into the android/app directory within your Flutter project.

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.


2 Answers

Above asked question has been solved as according to documentation at developer.google.com https://developers.google.com/cloud-messaging/android/client#get-config

2018 Edit : GCM Deprecated, use FCM

The file google-services.json should be pasted in the app/ directory. After this is when I sync the project with gradle file the unexpected Top level exception error comes. This is occurring because:

Project-Level Gradle File having

dependencies {     classpath 'com.android.tools.build:gradle:1.0.0'     classpath 'com.google.gms:google-services:1.3.0-beta1' } 

and App-Level Gradle File having:

dependencies {     compile fileTree(dir: 'libs', include: ['*.jar'])     compile 'com.android.support:appcompat-v7:22.1.1'     compile 'com.google.android.gms:play-services:7.5.0' // commenting this lineworks for me } 

The top line is creating a conflict between this and classpath 'com.google.gms:google-services:1.3.0-beta1' So I make comment it now it works Fine and no error of File google-services.json is missing from module root folder. The Google Quickstart Plugin cannot function without it.

like image 76
Lalit Kushwah Avatar answered Oct 15 '22 14:10

Lalit Kushwah


The document says:

Copy the file into the app/ folder of your Android Studio project, or into the app/src/{build_type} folder if you are using multiple build types.

like image 20
Nari Kim Shin Avatar answered Oct 15 '22 13:10

Nari Kim Shin