I am trying to configure the build.gradle file only to complete the gradle task when I select the release build option. Until now, my task has always been carried out, regardless of whether it is part of my debug or release types, and also signs configs. I tried to add my task to the applicationsVariants block and check if this is a release option, but it just looks through all the options.
applicationVariants.all { variant -> variant.outputs.each { output -> ... } }
I know that both debugging and release tasks are always performed depending on which build option you choose. Is it possible to execute some code only when creating an assembly for release? If so, where does this code go? Thanks!
I read every Stackoverflow question about this, but none of the answers I really wanted. My ultimate goal is when I select the "release" build option for the Play Store build, the message is sent to our server. I do not want this to happen when I am just debugging.
source share