Gradle - sirdnt/quintessence GitHub Wiki
android {
signingConfigs {
debug_youtube {
keyAlias '<Alias>'
keyPassword '<alias-pass>'
storeFile file('keystore/your_key.keystore')
storePassword '<store-pass>'
}
}
...
buildTypes {
debug {
signingConfig signingConfigs.debug_youtube
}
}
}
Useful for save private key, and switch debug or release key
gradle.properties (this file should not be tracked by source version-control)
MY_PRIVATE_DEBUG_KEY="7e263e55c"
MY_PRIVATE_RELEASE_KEY="7e263e567"
build.gradle
buildTypes {
debug {
buildConfigField "String", "SECRET_KEY", MY_PRIVATE_DEBUG_KEY
}
debug {
buildConfigField "String", "SECRET_KEY", MY_PRIVATE_RELEASE_KEY
}
}
Usage
BuildConfig.SECRET_KEY