【问题标题】:Glide Process 'command 'git'' finished with non-zero exit value 128Glide Process 'command 'git'' 以非零退出值 128 完成
【发布时间】:2016-01-27 05:50:37
【问题描述】:

我从 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 构建。是因为 Android Studio 的版本问题?

【问题讨论】:

  • 我不知道根本原因,但似乎 Gradle 任务正在运行某个 Git 进程,但它是从 Git 存储库位置之外的目录运行的。
  • 发布您的 settings.gradle。该日志讨论了一个 git 命令。很奇怪
  • 可能你已经移动了你的源代码文件夹。

标签: android git gradle android-glide


【解决方案1】:

我也发生了同样的错误。

在 build.gradle 之前的代码中

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

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

那个错误消失了。

下面是添加代码后的代码

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

    }

【讨论】:

    【解决方案2】:
    exec {
        commandLine "git", "submodule", "update", "--init", "--recursive"
    }
    

    然后我在git之前添加了cmd

    那个错误消失了。

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

    【讨论】:

    • 这可能会或可能不会在 Windows 上工作,但 OP 在他的问题中使用 Unix 路径,所以这个答案不太可能对她或他有用。
    【解决方案3】:

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

    什么对我有用:

    • Gradle Build Android Studio Project 的解决方案
    • git 克隆项目。或者将您的项目上传到git,然后将Fresh 克隆到您PC 的空文件夹中。 (这是为了正确配置git,其他方式不适用于我的项目)
    • 如果存在任何.idea 文件夹,请删除。
    • 作为现有Android Studio 项目打开。
    • 让它滚动。如果它需要任何依赖,请继续。

    【讨论】:

      【解决方案4】:
      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"
      }
      

      【讨论】:

        【解决方案5】:

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

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

        【讨论】:

          【解决方案6】:

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

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

          【讨论】:

            猜你喜欢
            • 2022-10-25
            • 1970-01-01
            • 2017-03-08
            • 2015-01-21
            • 2015-05-28
            • 2015-07-13
            • 2016-04-02
            • 2015-10-14
            相关资源
            最近更新 更多