I'm having an issues where System.getenv() is returning null for the environment variable. My password is stored in the RELEASE_PASSWORD environment variable. When I do:
$ echo $RELEASE_PASSWORD
it prints out the correct value, so I know the variable is set.
I was originally setting the signingConfig signingConfigs.release
in the release buildType and everything was working fine, but I need different signing configs for different product flavors. If I hardcode the password, it works just like it is suppose to. Things only get wonky when I try to read the password from an environment variable.
Is it some sort of scope issue?
This is what I currently have in my build.gradle
.
android {
...
signingConfigs {
release {
storeFile ...;
keyAlias ...;
storePassword System.getenv("RELEASE_PASSWORD");
keyPassword System.getenv("RELEASE_PASSWORD");
}
unsigned {
keyAlias "";
storePassword "";
keyPassword "";
}
}
buildTypes {
debug {
versionNameSuffix = "-DEBUG"
}
release {
}
}
flavorGroups "storeFront"
productFlavors {
def googleVariable = signingConfigs.release
def amazonVariable = signingConfigs.unsigned
google {
flavorGroup "storeFront"
signingConfig googleVariable
}
amazon {
flavorGroup "storeFront"
signingConfig amazonVariable
}
}
}