Skip to content

Instantly share code, notes, and snippets.

@eurycea
Last active February 8, 2021 06:31
Show Gist options
  • Save eurycea/1e4b73c11e268a2463ea to your computer and use it in GitHub Desktop.
Save eurycea/1e4b73c11e268a2463ea to your computer and use it in GitHub Desktop.
Android Build Config Field from command line
//from http://stackoverflow.com/a/28517135
buildTypes {
release {
buildConfigField "boolean", "DEVELOPER_MODE", developerMode("false")
}
debug{
buildConfigField "boolean", "DEVELOPER_MODE", developerMode("true")
}
}
def developerMode(String defaultValue){
def value = project.getProperties().get("developerMode")
return value != null ? value : defaultValue
}
./gradlew clean assembleRelease -PdeveloperMode=true
...
if(BuildConfig.DEVELOPER_MODE){
doDeveloperModeThing();
}
...
@priyankkasera
Copy link

priyankkasera commented Jun 22, 2018

can i modify more properties while creating apk ? if Yes then how our command looks like ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment