skip to Main Content

I started vs code and got the error flutter daemon failed to start. I opened the log and the error was that git was not found in path even though i have added git to path. Here is the log

[6:54:12 PM] [FlutterDaemon] [Info] Spawning C:flutterbinflutter.bat with args ["daemon"]
[6:54:12 PM] [FlutterDaemon] [Info] ..  in C:flutter
[6:54:12 PM] [FlutterDaemon] [Info] ..  with {"toolEnv":{"FLUTTER_HOST":"VSCode","PUB_ENVIRONMENT":"vscode.dart-code","FLUTTER_ROOT":"C:\flutter"}}
[6:54:12 PM] [FlutterDaemon] [Info]     PID: 14948
[6:54:12 PM] [Analyzer] [Info] Spawning C:flutterbincachedart-sdkbindart.exe with args ["language-server","--protocol=lsp","--client-id=VS-Code","--client-version=3.74.0"]
[6:54:12 PM] [Analyzer] [Info]     PID: 21988
[6:54:12 PM] [General] [Info] Returning cached results for project search
[6:54:12 PM] [General] [Info] Activating Flutter extension for Flutter project...
[6:54:12 PM] [DevTools] [Info] Spawning C:flutterbincachedart-sdkbindart.exe with args ["devtools","--machine","--try-ports","10","--allow-embedding"]
[6:54:12 PM] [DevTools] [Info] ..  with {"toolEnv":{"FLUTTER_HOST":"VSCode","PUB_ENVIRONMENT":"vscode.dart-code","FLUTTER_ROOT":"C:\flutter"}}
[6:54:12 PM] [DevTools] [Info]     PID: 14948
[6:54:12 PM] [General] [Info] Version last used for Pub is 3.1.5 (3.1.0), current is 3.1.5 (3.1.0)
[6:54:12 PM] [General] [Info] Found 0 folders requiring "pub get" or "pub upgrade":
[6:54:12 PM] [Analyzer] [Info] ==> Content-Length: 6429
[6:54:12 PM] [Analyzer] [Info] ==> {"jsonrpc":"2.0","id":0,"method":"initialize","params":{"processId":14948,"clientInfo":{"name":"Visual Studio Code","version":"1.83.1"},"locale":"en","rootPath":"c:\Windows\System32\learningdart","rootUri":"file:///C%3A/Windows/System32/learningdart","capabilities":{"workspace":{"applyEdit":true,"workspaceEdit":{"documentChanges":true,"resourceOperations":["create","rename","delete"],"failureHandling":"textOnlyTransactional","normalizesLineEndings":true,"changeAnnotationSupport":{"groupsO…
[6:54:12 PM] [General] [Info] Loaded 20000 package names from vscode-userdata:/c%3A/Users/preda/AppData/Roaming/Code/User/globalStorage/dart-code.dart-code/package_cache.json
[6:54:12 PM] [FlutterDaemon] [Info] <== Error: Unable to find git in your PATH.

2

Answers


  1. Chosen as BEST ANSWER

    I reinstalled git and launched the flutter project from cmd and it worked but now when i try to run i get this error:

    FAILURE: Build failed with an exception.
    
    * What went wrong:
    Execution failed for task ':app:processDebugResources'.
    > A failure occurred while executing com.android.build.gradle.internal.res.LinkApplicationAndroidResourcesTask$TaskAction
       > Android resource linking failed
         C:WindowsSystem32learningdartbuildappintermediatespackaged_manifestsdebugAndroidManifest.xml: error: failed to load XML file: The system cannot find the file specified. (2).
    
    
    * Try:
    > Run with --stacktrace option to get the stack trace.
    > Run with --info or --debug option to get more log output.
    > Run with --scan to get full insights.
    
    * Get more help at https://help.gradle.org
    
    BUILD FAILED in 1s
    Exception: Gradle task assembleDebug failed with exit code 1
    

    I managed to locate the xml file that causes the error but i dont know what to do with it. Anyone can help?


  2. Ensure that Git’s bin directory is included in your system’s PATH environment variable.

    Update the git path using the following steps:

    For Windows:

    • Search for "Environment Variables" in the Start menu and select "Edit the system environment variables."
    • Click the "Environment Variables" button.
    • Under "System variables," locate the "Path" variable and click "Edit."
    • Ensure that the path to Git’s bin directory (C:Program FilesGitbin) is listed. If not, add it.

    For macOS and Linux:

    • Open your shell configuration file (.bashrc or .profile) in a text editor.
    • Verify that the path to Git’s bin directory (/usr/local/git/bin) is included in the PATH variable. If not, add it, and save the file.
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search