Android Configure the build.gradle with signing configuration


Example

You can define the signing configuration to sign the apk in the build.gradle file.

You can define:

  • storeFile : the keystore file
  • storePassword: the keystore password
  • keyAlias: a key alias name
  • keyPassword: A key alias password

You have to define the signingConfigs block to create a signing configuration:

android {
    signingConfigs {

        myConfig {
            storeFile file("myFile.keystore")
            storePassword "xxxx"
            keyAlias "xxxx"
            keyPassword "xxxx"
        }
    }
    //....
}

Then you can assign it to one or more build types.

android {

    buildTypes {
        release {
            signingConfig signingConfigs.myConfig
        }
    }
}