Last active
February 8, 2021 06:31
-
-
Save eurycea/1e4b73c11e268a2463ea to your computer and use it in GitHub Desktop.
Android Build Config Field from command line
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//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 | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
./gradlew clean assembleRelease -PdeveloperMode=true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
... | |
if(BuildConfig.DEVELOPER_MODE){ | |
doDeveloperModeThing(); | |
} | |
... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
can i modify more properties while creating apk ? if Yes then how our command looks like ?