9

I have downloaded Glide from Github and wanted to test the program on Android studio. But once i Clean the project, i have this error

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 

what does the error mean? I have build using Gradle.it is because of version problem on Android studio?

Sam Judd
  • 7,317
  • 1
  • 38
  • 38
michelletbs
  • 809
  • 2
  • 9
  • 19

9 Answers9

15

Same error occurred for me also.

In build.gradle previous code like

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

then I added 'cmd' before 'git'

and that error gone.

below is code after adding the code

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

    }
Zumbarlal Saindane
  • 1,199
  • 11
  • 24
4
exec {
    commandLine "git", "submodule", "update", "--init", "--recursive"
}

Then I added cmd before git.

and that error gone.

exec {
    commandLine "cmd","git", "submodule", "update", "--init", "--recursive"
}
Zumbarlal Saindane
  • 1,199
  • 11
  • 24
陈利津
  • 41
  • 3
  • This may or may not work on Windows, but the OP uses Unix paths in his question, so this answer is unlikely to work for her or him. – Robert Aug 02 '18 at 04:16
3

This happen if git not configured properly with the Android Studio project.
And nobody seems experienced this before. Because I google thousand times and solutions not work.

What is just work for me:

  • Solution for Gradle Build Android Studio Project
  • Clone the project from git. Or Upload your project to git and clone Fresh in empty folder of your PC. (This is for configure git properly, other way did not work properly to my project)
  • Delete if any .idea folder exists.
  • Open as existing Android Studio project.
  • Let it roll. If it require any dependency, continue with that.
agua from mars
  • 16,428
  • 4
  • 61
  • 70
2
new ByteArrayOutputStream().withStream { os ->
    def result = exec {
        executable = 'git'
        args = ['log', '-1', '--pretty=format:%ct']
        standardOutput = os
    }

    return os.toString() + "000"
}

Change to the following code

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

    return os.toString() + "000"
}
younes
  • 742
  • 7
  • 8
0

Take a look at this, it is the only answer that worked for me on OSX

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

Greensouth
  • 41
  • 1
  • 9
0

In MAC OS redownload command-line tools and make sure that it is assigned to path.

A easy fix is to install Xcode and run a demo project. This sets up the dependencies properly.

Narendra_Nath
  • 4,578
  • 3
  • 13
  • 31
0

the process is executing in the gradle's own directory (~/.gradle/x.y.z)

use cmd.execute([], project.projectDir) with arguments

Pnemonic
  • 1,685
  • 17
  • 17
0

In my case when I checked git status I got the following output:

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

which I did and it worked :) (the path is just an example, but you will get your full path of the project)

Notron
  • 76
  • 7
0
  1. In Android Studio, File > New > Project from Version Control.
  2. Use your url as URL, click the clone button.
Sur Khosh
  • 115
  • 1
  • 8