Gradle: Keystore file not set for signing config release



Hi, guys!
I’m facing a problem with signing an Android app. I can easily sign the app locally but when I do this via CircleCI I have an error:

Execution failed for task ':app:validateSigningMtDebugSigned'.
> Keystore file not set for signing config release

I’m attaching the signing config for release build to show how I do this:

signingConfigs {
        if (System.getenv("CIRCLECI")) { // for
            debug {
                storeFile file(System.getenv("KEYSTORE_DEBUG"))
                storePassword 'android'
                keyAlias 'androiddebugkey'
                keyPassword 'android'
            release {
                storeFile file(System.getenv("KEYSTORE_RELEASE"))
                keyAlias System.getenv("KEYSTORE_PASSWORD")
                storePassword System.getenv("KEY_ALIAS")
                keyPassword System.getenv("KEY_PASSWORD")
        } else {
            release {

As you can see I store the path to release and debug keys in environment variables. Here is the values for storeFile:

KEYSTORE_RELEASE: /home/ubuntu/android/keys/release.keystore
KEYSTORE_DEBUG: /home/ubuntu/android/keys/debug.keystore

Do you have an idea where could be a problem?