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
I'm using this code and working very fine.
def baseUrl = '\"http://patelwala.com/myapi/"'
def googleServerKey = '\"87171841097-opu71rk2ps35ibv96ud57g3ktto6ioio.apps.googleusercontent.com"'
android {
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
buildConfigField 'String', 'BASE_URL', baseUrl
buildConfigField 'String', 'web_client_id', googleServerKey
}
releasedebug {
initWith debug
buildConfigField 'String', 'BASE_URL', baseUrl
buildConfigField 'String', 'web_client_id' ,googleServerKey
}
debug {
buildConfigField 'String', 'BASE_URL', baseUrl
buildConfigField 'String', 'web_client_id', googleServerKey
}
}
}
}