dart Flutter守护进程无法启动

pbwdgjma  于 2023-11-14  发布在  Flutter
关注(0)|答案(2)|浏览(115)

我启动vs code,得到错误flutter daemon failed to start。我打开日志,错误是git在path中找不到,即使我已经将git添加到path中。这是日志

[6:54:12 PM] [FlutterDaemon] [Info] Spawning C:\flutter\bin\flutter.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:\flutter\bin\cache\dart-sdk\bin\dart.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:\flutter\bin\cache\dart-sdk\bin\dart.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.

字符串

cclgggtu

cclgggtu1#

确保Git的bin目录包含在系统的PATH环境变量中。
使用以下步骤更新git路径:

适用于Windows

  • 在开始菜单中搜索“环境变量”,然后选择“编辑系统环境变量”。
  • 单击“环境变量”按钮。
  • 在“系统变量”下,找到“路径”变量并点击“编辑”。
  • 确保列出了Git的bin目录(C:\Program Files\Git\bin)的路径。如果没有,添加它。
    对于macOS和Linux
  • 在文本编辑器中打开shell配置文件(.bashrc.profile)。
  • 检查Git的bin目录(/usr/local/git/bin)的路径是否包含在PATH变量中。如果没有,添加它,然后保存文件。
wlzqhblo

wlzqhblo2#

我重新安装了git并从cmd启动了flutter项目,它工作了,但现在当我尝试运行时,我得到了这个错误:

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:\Windows\System32\learningdart\build\app\intermediates\packaged_manifests\debug\AndroidManifest.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

字符串
我设法找到导致错误的xml文件,但我不知道该怎么办。任何人都可以帮助?

相关问题