Reputation: 6069
We have lots of developers and lots of devices and lots of fresh and old versions of apk. Sometimes bad behaviour is occurred. I need to detect what version of the apk is installed on the device (what branch, what last commit, what files was changed from last commit, when apk criated).
We use Gradle to make apk from projects.
Is there any method (directive or plugin or script) to place the version information somewhere in the apk? For example, as constant in java class or as text file in resources.
Upvotes: 4
Views: 1439
Reputation: 20130
You could use next snippet:
task gitInfo << {
ext.revision = getGitRevParseInfo ( "--short" )
ext.branch = getGitRevParseInfo ( "--abbrev-ref" )
println ext.revision
println ext.branch
}
def getGitRevParseInfo (what) {
def cmd = "git rev-parse " + what + " HEAD"
def proc = cmd.execute ()
proc.text.trim ()
}
So you can use ext
for constructing versionName
for android app
Upvotes: 6