buddybuild and Firebase/Google Services
November 16, 2017So, after stumbling around for a while this afternoon trying to figure out how to get a secure google-services.json
file on buddybuild for my automated Android builds, I’d figure I’d record it here. Both for my benefit and for the benefit of someone else Googling it because Googling didn’t help me that much.
First, you’ll want to upload the google-services.json
file you get from Firebase to buddybuild’s secure files area. From there, you’ll want to add a buddybuild pre-build script if you don’t have one already. It sits in the root of your git repo and is named buddybuild_prebuild.sh
.
Once you’ve created that, you’ll want to add the line:
cp $BUDDYBUILD_SECURE_FILES/google-services.json app/google-services.json
Voila! You should now build and not get the following error:
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:processDebugGoogleServices'.
> File google-services.json is missing. The Google Services Plugin cannot function without it.
Searched Location:
/tmp/sandbox/workspace/app/src/debug/google-services.json
/tmp/sandbox/workspace/app/google-services.json
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
* Get more help at https://help.gradle.org
BUILD FAILED in 16s
You can obviously do this for different build variants, etc, but I figure most people are running into the basic, typical use-case.
Hopefully this helps some frustrated person somewhere. Or probably just me at a later date.