When I migrate Android project from Eclipse to Android Studio, use travis ci to build the project, it has the following errors.
FAILURE: Build failed with
I catch revision in revision property from git command output in the code (code universal for unix /first exec/ and windows /second exec/, command git must work from console)
def os = System.getProperty("os.name").toLowerCase()
def revision = new ByteArrayOutputStream()
if (!os.contains("windows")) {
exec {
executable "/bin/sh"
args "-c", "echo -n `git rev-list HEAD | wc -l | sed 's/^[ ^t]*//'`"
standardOutput = revision;
}
} else {
exec {
executable "cmd"
args "/c", "git rev-list HEAD | find /c /v \"\""
standardOutput = revision;
}
revision = revision as String
revision = revision.trim()
};
You can change code for you needed.