The instructions here did not work for me out of the box. I had to change the key.properties
file path to:
def keystorePropertiesFile = rootProject.file('app/key.properties')
You can test your configuration is being read properly or not by printing the values to the console. For example, in your gradle file you can have:
println keystorePropertiesFile
to make sure that object is populated with the values you expect