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

18,955

Solution 1

Add multiDexEnabled true in your project app gradle file and check,

defaultConfig {
    multiDexEnabled true
}

Solution 2

  1. Go to firebase console

  2. Create a new project.

  3. Then go and click on Add Firebase to your Android app

  4. Add Package name (from AndroidManifest.xml)

  5. Then it'll generate google-services.json

  6. Copy this file and add it to (i) your project root (ii) your project>app

  7. Sync project (Tools -> Android -> Sync Project with Gradle Files)

Hope this will help to you :)

Solution 3

enter image description hereIf you want to use firebase or other google cloud platform then download google-services.json from link - https://console.firebase.google.com/u/0/project/raafta-aac07/settings/general/

Else you don't want to use it then , just remove apply plugin: 'com.google.gms.google-services' from build.gradle from Android Studio

Solution 4

That Problem is because:- The folder or file you pasted to your product downloaded from the firebase console is not named as google-services.json. so now click it then right mouse click in all the options open refractor and rename it to google-services.json. because this worked for me

Share:
18,955
Adam Varhegyi
Author by

Adam Varhegyi

I like the color blue. Often eating gyros.

Updated on July 26, 2022

Comments

  • Adam Varhegyi
    Adam Varhegyi almost 2 years

    I have a project with 1 module and 2 applications. The module is used for code parts that both applications uses. Of course I have separate google-services.json files in the app's root folders.

    The build was working very well last Friday.

    Now I try to compile and got this error:

    File google-services.json is missing from module root folder. The Google Services Plugin cannot function without it.
    :DoToDoSenderApp:compileDebugSources
    :DoToDoSenderApp:transformClassesWithDexForDebug
    UNEXPECTED TOP-LEVEL EXCEPTION:
    Error:Execution failed for task ':DoToDoSenderApp:transformClassesWithDexForDebug'.
    > com.android.build.transform.api.TransformException: com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Program Files\Java\jdk1.8.0_45\bin\java.exe'' finished with non-zero exit value 2
    

    The only informative error message was about this google-services.json file missing in my module root folder.

    I don't know what is the problem here?

    The module is not an application, why would I have to add a google-services.json file and why it was worked some days ago without modification?

    Edit

    I have made a new Google app in Google API console and added a new google-services.json file even to my module, got the same error.

    • Arthur Thompson
      Arthur Thompson over 8 years
      Could you add a description of the folder structure, showing the project, apps and where the google-services.json files are.
  • Raghunandan
    Raghunandan over 8 years
    tried that but i still get the same error message this happens only after upgrading play services
  • djdance
    djdance almost 7 years
    as for me, I've pasted nothing, AS made all from Assistant... and what I should to rename now?
  • Sharone Lev
    Sharone Lev about 3 years
    For some reason when I cloned the repo, the file was named mock-google-services.json. I renamed it and placed in app folder and it worked.