滑行进程 '命令 'git 完成,退出值为非零 128



我已经从Github下载了Glide,并希望在Android studio上测试该程序。但是一旦我清理了项目,我就出现了这个错误

Information:Gradle tasks [clean]
fatal: Not a git repository (or any of the parent directories): .git
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred evaluating settings 'glide-master'.
> Process 'command 'git'' finished with non-zero exit value 128
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
Information:BUILD FAILED
Information:Total time: 0.28 secs
Error:fatal: Not a git repository (or any of the parent directories): .git
FAILURE: Build failed with an exception.
* Where:
Settings file '/Users/MyComputer/Downloads/glide-master/settings.gradle' line: 1
* What went wrong:
A problem occurred evaluating settings 'glide-master'.
> Process 'command 'git'' finished with non-zero exit value 128
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
Information:1 error
Information:0 warnings
Information:See complete output in console 

错误是什么意思?我使用 Gradle.it 构建是因为安卓工作室的版本问题?

我也发生了同样的错误。

在build.gradle以前的代码中,例如

exec {
        commandLine 'git', 'describe', '--tags'
    }

然后我在'git'之前添加了'cmd'

那个错误消失了。

下面是添加代码后的代码

exec {
        commandLine 'cmd', 'git', 'describe', '--tags'
    }
exec {
    commandLine "git", "submodule", "update", "--init", "--recursive"
}

然后我在git之前添加了cmd.

那个错误消失了。

exec {
    commandLine "cmd","git", "submodule", "update", "--init", "--recursive"
}

如果未正确配置Android Studio项目git则会发生这种情况。
以前似乎没有人经历过这种情况。因为我谷歌了一千次,解决方案不起作用。

什么只是对我有用:

  • Gradle Build Android Studio Project解决方案
  • git 克隆项目。或者将项目上传到git并在PC的空文件夹中克隆Fresh。(这是为了正确配置git,其他方式对我的项目不起作用)
  • 如果存在任何.idea文件夹,请删除。
  • 作为现有Android Studio项目打开。
  • 让它滚动。如果它需要任何依赖项,请继续。
new ByteArrayOutputStream().withStream { os ->
    def result = exec {
        executable = 'git'
        args = ['log', '-1', '--pretty=format:%ct']
        standardOutput = os
    }
    return os.toString() + "000"
}

更改为以下代码

new ByteArrayOutputStream().withStream { os ->
    def result = exec {
        executable = 'cmd'
        args = ['log', '-1', '--pretty=format:%ct']
        standardOutput = os
    }
    return os.toString() + "000"
}

看看这个,这是在OSX上对我有用的唯一答案

https://stackoverflow.com/a/27100821/2587350

在 MAC OS 中,重新下载命令行工具并确保将其分配给 path。

一个简单的解决方法是安装 Xcode 并运行演示项目。这样可以正确设置依赖项。

进程

正在 gradle 自己的目录中执行 ( ~/.gradle/x.y.z

cmd.execute([], project.projectDir)与参数一起使用

就我而言,当我检查git status时,我得到了以下输出:

fatal: unsafe repository ('/home/Documents/Examples/Example.App' is owned by someone else)
To add an exception for this directory, call:
git config --global --add safe.directory /home/Documents/Examples/Example.App

我做到了,它:)(路径只是一个示例,但您将获得项目的完整路径)

  1. 在 Android Studio 中,从版本控制中>新>项目。
  2. 使用your url作为 URL,单击克隆按钮。

最新更新