Skip to content Skip to sidebar Skip to footer

Command Git Finished With Non-zero Exit Value 128

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 an exception. * Where:

Solution 1:

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)

defos = System.getProperty("os.name").toLowerCase()
defrevision = 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.

Post a Comment for "Command Git Finished With Non-zero Exit Value 128"