Describe the bug
Unable to detect connected devices or even the emulator even though the devices are successfully connected. Running "adb devices" shows the list of connected devices, but on the toolbar in VS Code the extension still shows "No Device". Clicking on the device tab in the tool bar then show an alert with the message "The Flutter Daemon Has Terminated". Clicking on "try again" does not help, still shows the same alert.
Expected behavior
Show a list of connected devices.
Screenshots
Versions (please complete the following information):
Can you click the "Show Log" button on the message and see if there any errors near the bottom? Thanks!
These are the [FlutterDaemon] entries in the log:
...
App: Visual Studio Code
Version: 1.50.1
Platform: win
Workspace type: Flutter
Analyzer type: DAS
Multi-root?: false
Dart SDK:
Loc: D:\Flutter\flutter\bin\cache\dart-sdk
Ver: 2.10.2
Flutter SDK:
Loc: D:\Flutter\flutter
Ver: 1.22.2
...
[18:52:03] [FlutterDaemon] [Info] Process terminated! 64, null
[18:52:04] [FlutterDaemon] [Info] ==> [{"id":"2","method":"emulator.getEmulators"}]
All the other log entries are from the [Analyzer].
@Node-Ninja could you try enabling the Flutter daemon log - that should capture more of what's happening with the Daemon without the analyzer pushing its event out of the log (Show Log only keeps a certain number of log entries).
Also - can you confirm what you're doing when this happens - is it immediately at startup, or when you do something specific (like start a debug session)? Thanks!
@DanTup
The steps I take:
flutter Daemon log:
!! PLEASE REVIEW THIS LOG FOR SENSITIVE INFORMATION BEFORE SHARING !!
Dart Code extension: 3.15.1
Flutter extension: 3.15.1 (not activated)
App: Visual Studio Code
Version: 1.50.1
Platform: win
Workspace type: Flutter
Analyzer type: DAS
Multi-root?: false
Dart SDK:
Loc: D:\Flutter\flutter\bin\cache\dart-sdk
Ver: 2.10.2
Flutter SDK:
Loc: D:\Flutter\flutter
Ver: 1.22.2
HTTP_PROXY: undefined
NO_PROXY: undefined
Mon Oct 26 2020 [19:08:33 GMT+0200 (South Africa Standard Time)] Log file started
[19:08:33] [FlutterDaemon] [Info] Spawning D:\Flutter\flutter\bin\flutter.bat with args ["--dart-define=KEY=xxxxxxxxxxxxxxxxxxxxxxx","daemon"]
[19:08:33] [FlutterDaemon] [Info] .. in D:\Flutter\flutter
[19:08:33] [FlutterDaemon] [Info] .. with {"toolEnv":{"FLUTTER_HOST":"VSCode","PUB_ENVIRONMENT":"vscode.dart-code"}}
[19:08:33] [FlutterDaemon] [Info] PID: 19164
[19:08:33] [FlutterDaemon] [Info] ==> [{"id":"1","method":"emulator.getEmulators"}]
[19:08:34] [FlutterDaemon] [Info] Process terminated! 64, null
[19:08:34] [FlutterDaemon] [Info] ==> [{"id":"2","method":"emulator.getEmulators"}]
Ok, I think there may be something wrong with the Android SDK then (maybe Flutter cannot locate it) - the same issue as https://github.com/flutter/flutter/issues/67293.
Can you post the full output of flutter doctor -v?
And also the output of flutter emulator -v?
@DanTup
Flutter Dr.
$ flutter doctor -v
[√] Flutter (Channel stable, 1.22.2, on Microsoft Windows [Version 10.0.18363.900], locale en-ZA)
• Flutter version 1.22.2 at D:\Flutter\flutter
• Framework revision 84f3d28555 (11 days ago), 2020-10-15 16:26:19 -0700
• Engine revision b8752bbfff
• Dart version 2.10.2
[√] Android toolchain - develop for Android devices (Android SDK version 29.0.3)
• Android SDK at D:\Android\sdk
• Platform android-29, build-tools 29.0.3
• ANDROID_SDK_ROOT = D:\Android\sdk
• Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
• Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)
• All Android licenses accepted.
[√] Android Studio (version 4.0)
• Android Studio at C:\Program Files\Android\Android Studio
• Flutter plugin version 49.0.2
• Dart plugin version 193.7547
• Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)
[√] VS Code (version 1.50.1)
• VS Code at C:\Users\donal\AppData\Local\Programs\Microsoft VS Code
• Flutter extension version 3.15.1
[√] Connected device (1 available)
• Android SDK built for x86 (mobile) • emulator-5554 • android-x86 • Android 10 (API 29) (emulator)
• No issues found!
Flutter Emulator:
$ flutter emulator -v
[ +108 ms] executing: [D:\Flutter\flutter/] git -c log.showSignature=false log -n 1 --pretty=format:%H
[ +44 ms] Exit code 0 from: git -c log.showSignature=false log -n 1 --pretty=format:%H
[ ] 84f3d28555368a70270e9ac8390a9441df95e752
[ ] executing: [D:\Flutter\flutter/] git tag --points-at HEAD
[ +32 ms] Exit code 0 from: git tag --points-at HEAD
[ ] 1.22.2
[ +7 ms] executing: [D:\Flutter\flutter/] git rev-parse --abbrev-ref --symbolic @{u}
[ +18 ms] Exit code 0 from: git rev-parse --abbrev-ref --symbolic @{u}
[ ] origin/stable
[ ] executing: [D:\Flutter\flutter/] git ls-remote --get-url origin
[ +15 ms] Exit code 0 from: git ls-remote --get-url origin
[ ] https://github.com/flutter/flutter.git
[ +46 ms] executing: [D:\Flutter\flutter/] git rev-parse --abbrev-ref HEAD
[ +18 ms] Exit code 0 from: git rev-parse --abbrev-ref HEAD
[ ] stable
[ +50 ms] Artifact Instance of 'AndroidMavenArtifacts' is not required, skipping update.
[ ] Artifact Instance of 'AndroidGenSnapshotArtifacts' is not required, skipping update.
[ ] Artifact Instance of 'AndroidInternalBuildArtifacts' is not required, skipping update.
[ ] Artifact Instance of 'IOSEngineArtifacts' is not required, skipping update.
[ ] Artifact Instance of 'FlutterWebSdk' is not required, skipping update.
[ +2 ms] Artifact Instance of 'WindowsEngineArtifacts' is not required, skipping update.
[ ] Artifact Instance of 'MacOSEngineArtifacts' is not required, skipping update.
[ ] Artifact Instance of 'LinuxEngineArtifacts' is not required, skipping update.
[ ] Artifact Instance of 'LinuxFuchsiaSDKArtifacts' is not required, skipping update.
[ ] Artifact Instance of 'MacOSFuchsiaSDKArtifacts' is not required, skipping update.
[ +4 ms] Artifact Instance of 'FlutterRunnerSDKArtifacts' is not required, skipping update.
[ ] Artifact Instance of 'FlutterRunnerDebugSymbols' is not required, skipping update.
[ +14 ms] Artifact Instance of 'MaterialFonts' is not required, skipping update.
[ +23 ms] Artifact Instance of 'GradleWrapper' is not required, skipping update.
[ ] Artifact Instance of 'AndroidMavenArtifacts' is not required, skipping update.
[ ] Artifact Instance of 'AndroidGenSnapshotArtifacts' is not required, skipping update.
[ ] Artifact Instance of 'AndroidInternalBuildArtifacts' is not required, skipping update.
[ ] Artifact Instance of 'IOSEngineArtifacts' is not required, skipping update.
[ ] Artifact Instance of 'FlutterWebSdk' is not required, skipping update.
[ ] Artifact Instance of 'FlutterSdk' is not required, skipping update.
[ ] Artifact Instance of 'WindowsEngineArtifacts' is not required, skipping update.
[ ] Artifact Instance of 'MacOSEngineArtifacts' is not required, skipping update.
[ ] Artifact Instance of 'LinuxEngineArtifacts' is not required, skipping update.
[ ] Artifact Instance of 'LinuxFuchsiaSDKArtifacts' is not required, skipping update.
[ ] Artifact Instance of 'MacOSFuchsiaSDKArtifacts' is not required, skipping update.
[ ] Artifact Instance of 'FlutterRunnerSDKArtifacts' is not required, skipping update.
[ ] Artifact Instance of 'FlutterRunnerDebugSymbols' is not required, skipping update.
[ ] Artifact Instance of 'IosUsbArtifacts' is not required, skipping update.
[ ] Artifact Instance of 'IosUsbArtifacts' is not required, skipping update.
[ ] Artifact Instance of 'IosUsbArtifacts' is not required, skipping update.
[ ] Artifact Instance of 'IosUsbArtifacts' is not required, skipping update.
[ ] Artifact Instance of 'IosUsbArtifacts' is not required, skipping update.
[ ] Artifact Instance of 'FontSubsetArtifacts' is not required, skipping update.
[ +24 ms] executing: D:\Android\sdk\emulator\emulator.exe -list-avds
[ +641 ms] Pixel_3_API_29
Pixel_3_XL
[ +5 ms] 2 available emulators:
[ +23 ms] Pixel_3_API_29 • Pixel 3 API 29 • Google • android
[ +1 ms] Pixel_3_XL • Pixel 3 XL • Google • android
[ ] To run an emulator, run 'flutter emulators --launch
[ ] To create a new emulator, run 'flutter emulators --create [--name xyz]'.
[ ] You can find more information on managing emulators at the links below:
https://developer.android.com/studio/run/managing-avds
https://developer.android.com/studio/command-line/avdmanager
[ +9 ms] "flutter emulators" took 772ms.
[ +291 ms] ensureAnalyticsSent: 265ms
[ +1 ms] Running shutdown hooks
[ +1 ms] Shutdown hooks complete
[ ] exiting with code 0
Thanks - that didn't help.
Could you try the following:
flutter daemon -v
Then paste the following and press <enter>:
[{"id":"2","method":"device.enable"}]
Then paste the following and press <enter>:
[{"id":"1","method":"emulator.getEmulators"}]
In theory, this should also terminate (since this is what VS Code was doing), but hopefully the output will have more information/an error that helps understand why.
Thanks!
@DanTup
So I just discovered something in the Flutter Daemon log (same one I sent above):
...
Mon Oct 26 2020 [19:08:33 GMT+0200 (South Africa Standard Time)] Log file started
[19:08:33] [FlutterDaemon] [Info] Spawning D:\Flutter\flutter\bin\flutter.bat with args ["--dart-define=KEY=xxxxxxxxxxxxxxxxxxxxxxx","daemon"]
[19:08:33] [FlutterDaemon] [Info] .. in D:\Flutter\flutter ....
The dart commands were being sent with an argument: --dart-define=KEY=xxxxxxxx , this was set in the config :
Removing the argument seems to solve the problem, I can now see the emulator in the device list:
Aha - that explains it. That setting is to pass arguments to all Flutter processes that are spawned. If you want to pass this to an app you're running, you should set it in the args field of a launch.json launch config.
I have the same issue after flutter upgrade. I'm using fvm and another project on 1.22.6 work properly.
Here is my log file
!! PLEASE REVIEW THIS LOG FOR SENSITIVE INFORMATION BEFORE SHARING !!
Dart Code extension: 3.21.1
Flutter extension: 3.21.0 (activated)
App: Visual Studio Code
Version: 1.55.2
Platform: win
HTTP_PROXY: undefined
NO_PROXY: undefined
Logging Categories:
FlutterDaemon
Sun May 02 2021 [22:53:28 GMT+0200 (Central European Summer Time)] Log file started
[10:53:29 PM] [FlutterDaemon] [Info] Spawning C:\tools\flutter\bin\flutter.bat with args ["--no-sound-null-safety","daemon"]
[10:53:29 PM] [FlutterDaemon] [Info] .. in C:\tools\flutter
[10:53:29 PM] [FlutterDaemon] [Info] .. with {"toolEnv":{"FLUTTER_HOST":"VSCode","PUB_ENVIRONMENT":"vscode.dart-code"}}
[10:53:29 PM] [FlutterDaemon] [Info] PID: 6132
[10:53:29 PM] [FlutterDaemon] [Info] ==> [{"id":"1","method":"emulator.getEmulators"}]
[10:53:30 PM] [General] [Error] Error during edit.getFixes: invalid file.
[10:53:30 PM] [FlutterDaemon] [Info] ==> [{"id":"2","method":"emulator.getEmulators"}]
[10:53:30 PM] [FlutterDaemon] [Info] Process terminated! 64, null
[10:53:36 PM] [FlutterDaemon] [Info] ==> [{"id":"3","method":"emulator.getEmulators"}]
[10:53:38 PM] [General] [Warn] Unable to launch due to no active device
[10:55:37 PM] [FlutterDaemon] [Info] ==> [{"id":"4","method":"emulator.getEmulators"}]
[10:55:39 PM] [General] [Warn] Unable to launch due to no active device
[10:56:47 PM] [FlutterDaemon] [Info] ==> [{"id":"5","method":"emulator.getEmulators"}]
@mgvora it's better to file new issues when you have problems than comment on the bottom of closed ones, otherwise they're more easily overlooked. I replied on the Flutter issue you also posted this one, but for convenience if others find this issue, it's below too:
@mgvora it looks like flutter daemon is being spawned with the --no-sound-null-safety which is incorrect. Have you possibly added this to the dart.flutterAdditionalArgs setting? That setting is only for things that should be passed to _all_ invocations of Flutter - if you want to pass arguments to just your own app, you should use args in launch.json or dart.flutterRunAdditionalArgs (note the name has "run" in it).
Hi,
I'am sorry, I did not notice it's closed. Now everything is working.
as you mentioned:
Thanks bro. Appreciated.
Great, glad to hear!
Most helpful comment
Aha - that explains it. That setting is to pass arguments to all Flutter processes that are spawned. If you want to pass this to an app you're running, you should set it in the
argsfield of alaunch.jsonlaunch config.