问题
I want to implement an update revision number automatically in the manifest file.
Here is my code:
def getGitRevision(){
new ByteArrayOutputStream().withStream { os ->
exec {
commandLine 'git', 'rev-list', 'HEAD', '--count'
args = ['info']
standardOutput = os
}
def outputAsString = os.toString()
def matchLastChangedRev = outputAsString =~ /Last Changed Rev: (\d+)/
ext.gitRev = "${matchLastChangedRev[0][1]}".toInteger()
}
return String.valueOf(gitRev);
}
But it throws the following error:
Error:(10, 0) Process 'command 'git'' finished with non-zero exit value 1
回答1:
Open the 'settings.gradle' file, and then you may delete some code as follow:
exec {
commandLine "git", "submodule", "update", "--init", "--recursive"
}
After finished this, you can't use the git function, but it worked for me to compile successfully.
来源:https://stackoverflow.com/questions/30026730/process-command-git-finished-with-non-zero-exit-value-1