Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Useful gist for loading Gradle properties from files
// Load properties from file in the way recommended by Android docs
//
// Usage:
// def keystoreProperties = loadProperties("keystore.properties")
// ...
// android {
// ...
// signingConfigs {
// releaseConfig {
// keyAlias keystoreProperties['keyAlias']
// keyPassword keystoreProperties['keyPassword']
// storeFile file(keystoreProperties['storeFile'])
// storePassword keystoreProperties['storePassword']
// }
// ...
ext.loadProperties = { propertiesName ->
def propertiesFile = rootProject.file(propertiesName)
def properties = new Properties()
properties.load(new FileInputStream(propertiesFile))
return properties
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment