Is it possible to declare a variable in Gradle usable in Java ? Basically I would like to declare some vars in the build.gradle and then getting it (obviously) at build time
rciovati's answer is entirely correct I just wanted to add one more tidbit that you can also create variables for every build type within the default config portion of your build.gradle. This would look like this:
android {
defaultConfig {
buildConfigField "String", "APP_NAME", "\"APP_NAME\""
}
}
This will allow you to have access to through
BuildConfig.App_NAME
Just wanted to make a note of this scenario as well if you want a common config.