Read versionName from build.gradle in bash
Expanding on Khozzy's answer, to retrieve versionName of your Android package from the build.gradle, add this custom task:
task printVersionName {
doLast {
println android.defaultConfig.versionName
}
}
and invoke it so:
gradle -q printVersionName
You can define a custom task, i.e.
task printVersion {
doLast {
println project.version
}
}
And execute it in Bash:
$ gradle -q pV
1.8.5