The Flutter daemon has been terminated

4k views Asked by At

Got a error when I launched the flutter app on VS Code

I tried a lot of solutions on the internet but none worked, I also tried re-installing Windows but that too didn't work

The Daemon log

[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"}]
3

There are 3 answers

0
piotrb86 On

Solution that worked for me on: Ubuntu 20.04, adb 33.0.1, Android Studio Bumblebee 2021.1.1:

  1. Android Studio > Settings > Build, Execution, Deployment > Debugger: Set "Use existing manually managed server" with port 5038.

enter image description here

  1. Close Android Studio
  2. path-to-android-sdk/platform-tools/adb kill-server
  3. path-to-android-sdk/platform-tools/adb start-server
  4. Start Android Studio

Event Log shows that it cannot reach ADB server which is fine. When you run with command in point 3. and 4. adb starts on port 5037. If Studio connected to manually started adb, it'd kill it. That's why 5038 (instead 5037) has to be set in Studio settings.

enter image description here

After next reboot you should just execute 4. and 5.

1
ramkumar On

Ive resolved this error with the below Steps:

  1. Go to {C://Users/{Name}/.gradle} - Delete the .gradle file.

  2. Then Download and install the same flutter and dart SDK version in some other location and set the environment variables.

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. Then kindly check the android studio Event Log enter image description here
0
Sithu On

I have similar issue in vs code. Only solution that worked for me is remove all the "--no-sound-null-safety" settings from .vscode/settings.json

{
    "xd.globalEditor": false,
    "xd.lastPackage": "/Users/username/Downloads/material-theme 2",
    "java.configuration.updateBuildConfiguration": "automatic",
    // "dart.flutterTestAdditionalArgs": ["--no-sound-null-safety"],
    // "dart.flutterAdditionalArgs": ["--no-sound-null-safety"],
    // "dart.vmAdditionalArgs": ["--no-sound-null-safety"],
}