1

在 VS Code 上启动颤振应用程序时出错

我在互联网上尝试了很多解决方案,但都没有奏效,我也尝试重新安装 Windows,但也没有用

守护进程日志

[10:31:08 PM] [General] [Info]         C:\src\flutter\bin\cache\dart-sdk\bin
[10:31:08 PM] [General] [Info]     Candidate paths to be post-filtered:
[10:31:08 PM] [General] [Info]         C:\src\flutter\bin\cache\dart-sdk
[10:31:08 PM] [General] [Info]         C:\src\flutter\bin\cache\dart-sdk
[10:31:08 PM] [General] [Info]     Found at C:\src\flutter\bin\cache\dart-sdk

    [10:31:08 PM] [General] [Info]     Returning SDK path C:\src\flutter\bin\cache\dart-sdk for dart.exe

    [10:31:08 PM] [General] [Info] Experiment random number is 69 for experiement 'lsp-default'. Experiment is enabled for <= 10
        [10:31:08 PM] [General] [Info] !! PLEASE REVIEW THIS LOG FOR SENSITIVE INFORMATION BEFORE SHARING !!
        Dart Code extension: 3.21.1
        Flutter extension: 3.21.0 (not activated)
        App: Visual Studio Code
        Version: 1.55.2
        Platform: win
        Workspace type: Flutter
        Analyzer type: DAS
        Multi-root?: false
        Dart SDK:
            Loc: C:\src\flutter\bin\cache\dart-sdk
            Ver: 2.12.3
        Flutter SDK:
            Loc: C:\src\flutter
            Ver: 2.0.6
        HTTP_PROXY: undefined
        NO_PROXY: undefined
        [10:31:08 PM] [General] [Info] Spawning C:\src\flutter\bin\cache\dart-sdk\bin\pub.bat with args ["global","list"]
        [10:31:08 PM] [CommandProcesses] [Info] (PROC undefined) Logging data for process...
        [10:31:08 PM] [Analyzer] [Info] Spawning C:\src\flutter\bin\cache\dart-sdk\bin\dart.exe with args ["C:\\src\\flutter\\bin\\cache\\dart-sdk\\bin\\snapshots\\analysis_server.dart.snapshot","--client-id=VS-Code","--client-version=3.21.1"]
        [10:31:08 PM] [Analyzer] [Info] ..  with {"toolEnv":{"FLUTTER_HOST":"VSCode","PUB_ENVIRONMENT":"vscode.dart-code"}}
        [10:31:08 PM] [Analyzer] [Info]     PID: 5292
        [10:31:08 PM] [Analyzer] [Info] ==> {"id":"1","method":"server.setSubscriptions","params":{"subscriptions":["STATUS"]},"clientRequestTime":1619888468969}
        [10:31:08 PM] [Analyzer] [Info] ==> {"id":"2","method":"analysis.setPriorityFiles","params":{"files":["D:\\GitHub\\fitify\\lib\\main.dart"]},"clientRequestTime":1619888468973}
        [10:31:08 PM] [Analyzer] [Info] ==> {"id":"3","method":"analysis.setSubscriptions","params":{"subscriptions":{"FOLDING":["D:\\GitHub\\fitify\\lib\\main.dart"],"OCCURRENCES":["D:\\GitHub\\fitify\\lib\\main.dart"],"OUTLINE":["D:\\GitHub\\fitify\\lib\\main.dart"]}},"clientRequestTime":1619888468976}
        [10:31:08 PM] [Analyzer] [Info] ==> {"id":"4","method":"analysis.updateContent","params":{"files":{"D:\\GitHub\\fitify\\lib\\main.dart":{"content":"import 'package:fitify/pages/app_Inro.dart';\r\nimport 'package:fitify/widgets/color.dart';\r\nimport 'package:flutter/material.dart';\r\n\r\nvoid main() {\r\n  runApp(MyApp());\r\n}\r\n\r\nclass MyApp extends StatelessWidget {\r\n  @override\r\n  Widget build(BuildContext context) {\r\n    return MaterialApp(\r\n      debugShowCheckedModeBanner: false,\r\n      theme: ThemeData(\r…
        [10:31:08 PM] [FlutterDaemon] [Info] Spawning C:\src\flutter\bin\flutter.bat with args ["daemon"]
        [10:31:08 PM] [FlutterDaemon] [Info] ..  in C:\src\flutter
        [10:31:08 PM] [FlutterDaemon] [Info] ..  with {"toolEnv":{"FLUTTER_HOST":"VSCode","PUB_ENVIRONMENT":"vscode.dart-code"}}
        [10:31:08 PM] [FlutterDaemon] [Info]     PID: 5292
        [10:31:08 PM] [FlutterDaemon] [Info] ==> [{"id":"1","method":"emulator.getEmulators"}]
4

1 回答 1

1

我已通过以下步骤解决了此错误:

  1. 转到{C://Users/{Name}/.gradle} - 删除.gradle文件。

  2. 然后在其他位置下载并安装相同的flutter和dart SDK版本并设置环境变量。

Example:

Environment variables Before : ("D:\FlutterExtractedFiles\flutter\bin") ("D:\FlutterExtractedFiles\flutter\bin\cache\dart-sdk\bin")

Environment variables After : ("C:\edgedownloads\flutter_windows_v1.12.13+hotfix.8-stable\flutter\bin") ("C:\edgedownloads\flutter_windows_v1.12.13+hotfix.8-stable\flutter\bin\cache\dart-sdk\bin")

  1. 然后请检查 android studio 事件日志 在此处输入图像描述
于 2021-09-13T18:04:46.047 回答