Search code examples
javaandroidgoogle-analyticsgoogle-analytics-firebasegoogle-play-services

Google-services.json is missing from module root folder


To preface, I've got three product flavors, and I have added the google-services.json to each product flavor folder. I do not have a google-services in the root folder however according to the docs this is OK.

I keep getting this error when trying to generate a signed APK in Android Studio. If I run the project directly to my phone (debug build) it works fine, which is very odd.

I'm using the following version of the plugin in my project build.gradle:

classpath 'com.google.gms:google-services:2.0.0-beta6'

According to the docs (https://developers.google.com/android/guides/google-services-plugin#introduction) since 2.0.0alpha3 there has been support for product flavors in the plugin.

I'm also using gradle-2.10-all.zip

classpath 'com.android.tools.build:gradle:2.0.0-beta6'

I'm trying to implement Google Analytics V4 which says I need to use a google-services configuration file. So I'm wondering what I'm doing wrong, if anything at all.

Has anyone else come across this? Would appreciate any help on the matter, thanks.


Solution

  • Posted an issue about this on the google samples github repo

    See issue here: https://github.com/googlesamples/google-services/issues/186

    In short this has been fixed by adding a google-services.json to the root/app folder which then gets overwritten by the google-service.json in each flavor folder.

    Tested it and it works well. While it still might be a bug with the google services plugin and how it works, at least there is a workaround.