Skip to content

Instantly share code, notes, and snippets.

@venator85
Created January 12, 2018 09:56
Show Gist options
  • Save venator85/08c3078dea31cde8697901cab441c25c to your computer and use it in GitHub Desktop.
Save venator85/08c3078dea31cde8697901cab441c25c to your computer and use it in GitHub Desktop.
Gradle task to print APK signing certificate information (e.g. SHA1 hash)
android.applicationVariants.all { variant ->
tasks.create(name: "signatureHash${variant.name.capitalize()}", type: Exec) {
group "util"
commandLine 'keytool', '-exportcert', '-list', '-v',
'-alias', variant.signingConfig.keyAlias,
'-keypass', variant.signingConfig.keyPassword,
'-keystore', variant.signingConfig.storeFile,
'-storepass', variant.signingConfig.storePassword
doFirst {
println ":: Signing config for variant ${variant.name} is: ${variant.signingConfig.name}\n"
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment