From e29c2ecfdb7d120ff8e3dd0e397b316a069076ca Mon Sep 17 00:00:00 2001 From: Ezerous Date: Fri, 23 Nov 2018 10:50:17 +0200 Subject: [PATCH] Avoid running in debug with release google-services.json --- app/build.gradle | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/app/build.gradle b/app/build.gradle index 85f9bba6..d36a6fee 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -47,7 +47,14 @@ tasks.whenTaskAdded { task -> def inputFile = new File("app/google-services.json") def json = new JsonSlurper().parseText(inputFile.text) if (json.project_info.project_id != "mthmmy-release-3aef0") - throw new GradleException('Please supply the correct google-services.json for release or manually change the id above!') + throw new GradleException('Please supply the correct google-services.json for release (or manually change the id above)!') + }) + } else if (task.name.contains("assembleDebug")) { + task.getDependsOn().add({ + def inputFile = new File("app/google-services.json") + def json = new JsonSlurper().parseText(inputFile.text) + if (json.project_info.project_id == "mthmmy-release-3aef0") + throw new GradleException('Please replace the release google-services.json with a debug one!') }) } }