27

I got the following warnings. How can I avoid this warnings?

Could not find google-services.json while looking in [src/flavor1/debug, src/debug, src/flavor1] Could not find google-services.json while looking in [src/flavor1/release, src/release, src/flavor1] Could not find google-services.json while looking in [src/flavor2/debug, src/debug, src/flavor2] Could not find google-services.json while looking in [src/flavor2/release, src/release, src/flavor2]


I added two client_info at app/google-services.json

{
  "project_info": {
    "project_number": "000000000000",
    "project_id": "****-*****"
  },
  "client": [
    {
      "client_info": {
        "mobilesdk_app_id": ...,
        "android_client_info": {
          "package_name": "flavor1.package.name"
        }
      },
      ...
    },
    {
      "client_info": {
        "mobilesdk_app_id": ...,
        "android_client_info": {
          "package_name": "flavor2.package.name"
        }
      },
      ...
    }
  ],
  "configuration_version": "1"
}
IntelliJ Amiya
  • 70,230
  • 14
  • 154
  • 181
DrumRobot
  • 267
  • 1
  • 3
  • 13
  • 8
    @Dhaust This is not a duplicate of https://stackoverflow.com/questions/30772201/google-services-json-for-different-productflavors?noredirect=1&lq=1 This only concerns the warnings and not that the file is missing. – Claus Holst Feb 19 '18 at 15:28

2 Answers2

8

As per my experience, this will occur when you are using any type of service related to firebase and you have not put the google-services.json the file which we needed to use the service,

The solution is you need to get the file from firebase console and you need to put inside of your app level folder if you are creating a single project in the console for all flavor and If you are creating different one then you need to create a number of files for a number of projects or flavors.

Dhaval Solanki
  • 4,093
  • 1
  • 21
  • 33
  • 76
    I have this file in the "/app/" folder, yet it doesn't find it. Instead it keeps showing me this in the build log: `Could not find google-services.json while looking in [src/nullnull/debug, src/debug/nullnull, src/nullnull, src/debug, src/nullnullDebug] registerResGeneratingTask is deprecated, use registerGeneratedResFolders(FileCollection)` – android developer May 28 '18 at 11:17
  • 33
    @androiddeveloper, using the latest google-services version (4.1.0 as of this writing) seems to fix it. – ozbek Aug 28 '18 at 08:52
  • 13
    This was an issue in google dependency and it's fixed now in com.google.gms:google-services:4.0.2 – M.Noman Oct 23 '18 at 07:01
  • @ozbek .. your answer work for me.. – tjungChaniago Apr 04 '19 at 02:29
6

Could not find google-services.json while looking in

According to LOGCAT, google-services.json is absent in right place (Missing).

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

For example, dogfood and release are build types.

 app/
    google-services.json
    src/dogfood/google-services.json
    src/release/google-services.json
    ...

Finally, Clean-Rebuild-Run.

IntelliJ Amiya
  • 70,230
  • 14
  • 154
  • 181