Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Gradle: signingConfig.name must not be null

After updating Gradle Wrapper to 5.6.4 and Gradle Plugin to 3.6.0, I get the following error:

Caused by: java.lang.IllegalStateException: signingConfig.name must not be null

My configuration looks like this:

root:

ext {
    Properties localProps = new Properties()
    localProps.load(rootProject.file('local.properties').newDataInputStream())

    mySigningConfigs = [
            debug  : SigningConfig.newInstance([
                    keyAlias     : "${localProps['keyAlias']}",
                    keyPassword  : "${localProps['keyPassword']}",
                    storeFile    : file('carrierKeystore.jks'),
                    storePassword: "${localProps['storePassword']}"
            ]),
            release: SigningConfig.newInstance([
                    keyAlias     : "${localProps['keyAlias']}",
                    keyPassword  : "${localProps['keyPassword']}",
                    storeFile    : file('carrierKeystore.jks'),
                    storePassword: "${localProps['storePassword']}"
            ])
    ]
}

module:

buildTypes {
        debug {
            signingConfig mySigningConfigs.debug
        }
        release {
            signingConfig mySigningConfigs.release
        }
    }

It worked great before, but not it's always saying name is null. Do you have any idea? Thanks.

like image 814
modsfabio Avatar asked Sep 05 '25 02:09

modsfabio


1 Answers

I figured out the problem

move the lines

buildTypes {
        debug {
            signingConfig mySigningConfigs.debug
        }
        release {
            signingConfig mySigningConfigs.release
        }
    }

to

signingConfigs {
        debug {
            mySigningConfigs.debug
        }
        release {
            mySigningConfigs.release
        }
    }

and put the signingConfigs block at the top of the android block

i.e

android {
  signingConfigs {
    ...
  }

  defaultConfigs {
    ...
  }

  buildTypes {
    ...
  }
}
like image 106
Lena Bru Avatar answered Sep 09 '25 18:09

Lena Bru



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!