Is isReleaseBuild () part of the Android Gradle DSL?

I followed instructions like these:

Android Gradle library release JAR

However, I am getting the following error:

Could not find isReleaseBuild () method for arguments [] in project ': myProject'.

None of the examples I've seen while integrating Maven define this feature, so I assumed it was built in. However, I am getting this error with Gradle 1.12 and 2.1, and Android Plugin 0.12. + And 0.13. +

If it is not a built-in function, what is the best practice for defining it?

+3


source to share


1 answer


Not. It is user defined but seems to permeate the examples because a lot of Gradle examples are copied.

This is how I defined it so that I can pass -PMAVEN_RELEASE_BUILD

on the command line to enable release builds.

def isReleaseBuild() {
    return hasProperty("MAVEN_RELEASE_BUILD") && MAVEN_RELEASE_BUILD == "true";
}

      



Some people also like to define version names that end in -SNAPSHOT

. I don't want to do this because I want to be able to choose whether the build will be debug or debug without checking the changes on gradle.properties.

def isReleaseBuild() {
    return !VERSION_NAME.contains("SNAPSHOT");
}

      

+1


source







All Articles