I think it has something to do with this warning I keep getting from dart sdk
Socket error: FileSystemException: Directory watcher closed unexpectedly, path =
'c:\Users\Saad\OneDrive\Documents\Scripts\mutanafisun'
I searched for a solution for it but found none.
this is my flutter doctor
[√] Flutter (Channel stable, 3.0.5, on Active code page: 1252
Microsoft Windows [Version 10.0.19044.1826], locale en-US)
• Flutter version 3.0.5 at C:\flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision f1875d570e (4 weeks ago), 2022-07-13 11:24:16 -0700
• Engine revision e85ea0e79c
• Dart version 2.17.6
• DevTools version 2.12.2
Checking Java status is taking a long time...[√] Android toolchain - develop for Android
devices (Android SDK version 31.0.0)
• Android SDK at C:\Users\Saad\AppData\Local\Android\sdk
• Platform android-31, build-tools 31.0.0
• Java binary at: C:\Program Files\Java\jdk-14\bin\java
• Java version Java(TM) SE Runtime Environment (build 14+36-1461)
• All Android licenses accepted.
[√] Chrome - develop for the web
• Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe
[√] Visual Studio - develop for Windows (Visual Studio Build Tools 2022 17.2.3)
• Visual Studio at C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools
• Visual Studio Build Tools 2022 version 17.2.32526.322
• Windows 10 SDK version 10.0.19041.0
[!] Android Studio (not installed)
• Android Studio not found; download from
https://developer.android.com/studio/index.html
(or visit https://flutter.dev/docs/get-started/install/windows#android-setup for
detailed instructions).
[√] VS Code (version 1.70.1)
• VS Code at C:\Users\Saad\AppData\Local\Programs\Microsoft VS Code
• Flutter extension version 3.46.0
This seems to be a bug in the current Dart/Flutter releases, however, it should not have any material affect on your app. You should be able to continue as normal:
When Flutter builds it modifies a lot of files on disk in a short space of time and this sometimes overflows the watcher and causes it to close. The server has code to handle this (it creates new watchers and reanalyzes from disk), however to resolve some other issues during the restart it creates some additional watchers which do not have error handling (and since the Flutter build may still be occurring, it's possible those will close for the same reason). It's not ideal that a Flutter build can touch enough files to overflow the watcher and require a restart like this, but I believe that's understood behaviour because the server has had to handle this before.
Here is a full discussion:
https://github.com/dart-lang/sdk/issues/49286
Also see confirmation that fix has been found but not yet released:
There is a bug in the current Dart/Flutter stable releases that can trigger this error during a build. [They] have recently fixed the issue in the Dart SDK, but it has not been released yet. The fix will show up in a future release of the Dart/Flutter SDK. Unfortunately [they] don't know of a temporary workaround.
https://github.com/Dart-Code/Dart-Code/issues/4077
Related
I opened VSCode a few days ago to continue work on a Flutter project, unfortunately, the Flutter and Dart usually take a while to start(2-3 minutes), but this time,the extensions failed to initialize, and I'm left with white colourless code and no access to the tools that come with the extensions(i.e F5 for debug).screenshot of the current state of things
Over the past few days, I have,
Deleted and re-installed the Flutter SDK(forgive me, I cant remember what version it was at before, but now its 3.3.7, Dart 2.18.4)
Deleted and re-installed VSCode(used to be a snap, now a .deb)
Uninstalled and re-installed the Flutter and Dart extensions(multiple times, restarted VSCode each time)
- Ran said project directly from the terminal to be sure I had the flutter tool correctly installed(flutter run and flutter build apk ran fine, with no errors)
Please find the results of 'flutter doctor -v' below
Flutter (Channel stable, 3.3.7, on Ubuntu 20.04.5 LTS 5.15.0-52-generic,
locale en_NG)
• Flutter version 3.3.7 on channel stable at
/home/alabi/snap/flutter/common/flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision e99c9c7cd9 (7 days ago), 2022-11-01 16:59:00 -0700
• Engine revision 857bd6b74c
• Dart version 2.18.4
• DevTools version 2.15.0
[!] Android toolchain - develop for Android devices (Android SDK version
32.1.0-rc1)
• Android SDK at /home/alabi/Android/Sdk
• Platform android-33, build-tools 32.1.0-rc1
• ANDROID_SDK_ROOT = /home/alabi/Android/Sdk
• Java binary at: /home/alabi/.jdks/openjdk-18.0.1.1/bin/java
• Java version OpenJDK Runtime Environment (build 18.0.1.1+2-6)
✗ Android license status unknown.
Run `flutter doctor --android-licenses` to accept the SDK licenses.
See https://flutter.dev/docs/get-started/install/linux#android-setup for
more details.
[✗] Chrome - develop for the web (Cannot find Chrome executable at
google-chrome)
! Cannot find Chrome. Try setting CHROME_EXECUTABLE to a Chrome executable.
[✓] Linux toolchain - develop for Linux desktop
• clang version 10.0.0-4ubuntu1
• cmake version 3.16.3
• ninja version 1.10.0
• pkg-config version 0.29.1
[!] Android Studio (not installed)
• Android Studio not found; download from
https://developer.android.com/studio/index.html
(or visit https://flutter.dev/docs/get-started/install/linux#android-setup
for detailed instructions).
[✓] VS Code (version 1.73.0)
• VS Code at /usr/share/code
• Flutter extension version 3.52.0
[✓] Connected device (1 available)
• Linux (desktop) • linux • linux-x64 • Ubuntu 20.04.5 LTS 5.15.0-52-generic
The CLI command, 'flutter --version' returns
Flutter 3.3.7 • channel stable • https://github.com/flutter/flutter.git
Framework • revision e99c9c7cd9 (7 days ago) • 2022-11-01 16:59:00 -0700
Engine • revision 857bd6b74c
Tools • Dart 2.18.4 • DevTools 2.15.0
All of this leads me to believe the Flutter SDK is installed correctly and the problem is with VSCode and the extensions
Any help is appreciated, thank you!
Make sure that you use official extensions for Flutter/Dart. They are created by Dart Code.
Fixed!
If something in the extension is corrupt you could try uninstalling the extensions and then deleting them from ~/.vscode/extensions (the ones starting dart-code) and then reinstall.
From DartCode's GitHub, read the issue and fix here if you're still confused
I am trying to start Windows app for first time with default Flutter Project but it's showing this error,
Launching lib\main.dart on Windows in debug mode...
lib\main.dart:1
Can't load AOT data from {#project-path}\build\windows\runner\Debug\data\app.so; no such file.
Unable to start engine without AOT data.
Failed to create view controller.
Error waiting for a debug connection: The log reader stopped unexpectedly, or never started.
Error launching application on Windows.
Exited (sigterm)
here is my flutter doctor -v result:
[√] Flutter (Channel stable, 2.10.2, on Microsoft Windows [Version 10.0.19044.1526], locale en-IN)
• Flutter version 2.10.2 at C:\src\flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 097d3313d8 (3 days ago), 2022-02-18 19:33:08 -0600
• Engine revision a83ed0e5e3
• Dart version 2.16.1
• DevTools version 2.9.2
[!] Android toolchain - develop for Android devices (Android SDK version 30.0.2)
• Android SDK at C:\Users\panth\AppData\Local\Android\sdk
X cmdline-tools component is missing
Run `path/to/sdkmanager --install "cmdline-tools;latest"`
See https://developer.android.com/studio/command-line for more details.
X Android license status unknown.
Run `flutter doctor --android-licenses` to accept the SDK licenses.
See https://flutter.dev/docs/get-started/install/windows#android-setup for more details.
[√] Chrome - develop for the web
• Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe
[√] Visual Studio - develop for Windows (Visual Studio Community 2022 17.1.0)
• Visual Studio at C:\Program Files\Microsoft Visual Studio\2022\Community
• Visual Studio Community 2022 version 17.1.32210.238
• Windows 10 SDK version 10.0.19041.0
[√] Android Studio (version 2020.3)
• Android Studio at C:\Program Files\Android\Android Studio
• Flutter plugin can be installed from:
https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
https://plugins.jetbrains.com/plugin/6351-dart
• Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7249189)
[√] VS Code (version 1.64.2)
• VS Code at C:\Users\panth\AppData\Local\Programs\Microsoft VS Code
• Flutter extension version 3.29.0
[√] VS Code, 64-bit edition (version 1.63.2)
• VS Code at C:\Program Files\Microsoft VS Code
• Flutter extension version 3.29.0
[√] Connected device (3 available)
• Windows (desktop) • windows • windows-x64 • Microsoft Windows [Version 10.0.19044.1526]
• Chrome (web) • chrome • web-javascript • Google Chrome 98.0.4758.102
• Edge (web) • edge • web-javascript • Microsoft Edge 98.0.1108.56
[√] HTTP Host Availability
• All required HTTP hosts are available
! Doctor found issues in 1 category.
Here is what i have already tried
copy paste app.so file from ./build/windows to ./build/windows/runner/Debug/data
this is an inefficient solution, since hot reload doesn't work.
downgrade visual studio to 2019
I tried to downgrade visual studio to 2019, and then deleted windows folder form root directory, then ran flutter clean and flutter create .. then started debug and this error happened
Launching lib\main.dart on Windows in debug mode...
lib\main.dart:1
Error waiting for a debug connection: The log reader stopped unexpectedly, or never started.
Error launching application on Windows.
Exited (sigterm)
so i uninstalled visual studio and installed 2022 version back.
Also tried flutter clean had no effect.
What can I do for this error?
This is a bug in the version of CMake shipped with the latest update to Visual Studio 2022. There is currently no good workaround other than using an earlier version of VS, but you can follow that issue for updates.
When you downgraded to Visual Studio 2019, did you simply delete Visual Studio 2022?
I found that when I simply deleted Visual Studio 2022, I had your same error. I had success by uninstalling then reinstalling "Desktop development with C++" from my Visual Studio 2019, followed by flutter clean and flutter run -d windows.
I have fixed from this github issue.flutter github issue
I am trying to start Windows app for first time with default Flutter Project but it's showing this error espacialy.
Unable to start engine without AOT data.
Failed to create view controller.
Error waiting for a debug connection: The log reader stopped unexpectedly, or never started.
Error launching application on Windows.
Exited (sigterm)
Here is my flutter doctor -v results:
[√] Flutter (Channel stable, 2.10.0, on Microsoft Windows [Version
10.0.19042.1526], locale tr-TR)
• Flutter version 2.10.0 at D:\src\flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 5f105a6ca7 (2 weeks ago), 2022-02-01 14:15:42 -0800
• Engine revision 776efd2034
• Dart version 2.16.0
• DevTools version 2.9.2
[√] Android toolchain - develop for Android devices (Android SDK version
31.0.0)
• Android SDK at D:\sdk
• Platform android-31, build-tools 31.0.0
• ANDROID_HOME = C:\Users\pc\AppData\Local\Android\Sdk
• Java binary at: D:\Android Studio\jre\bin\java
• Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7249189)
• All Android licenses accepted.
[X] Chrome - develop for the web (Cannot find Chrome executable at
.\Google\Chrome\Application\chrome.exe)
! Cannot find Chrome. Try setting CHROME_EXECUTABLE to a Chrome executable.
[√] Visual Studio - develop for Windows (Visual Studio Community 2022 17.1.0)
• Visual Studio at C:\Program Files\Microsoft Visual Studio\2022\Community
• Visual Studio Community 2022 version 17.1.32210.238
• Windows 10 SDK version 10.0.22000.0
[√] Android Studio (version 2020.3)
• Android Studio at D:\Android Studio
• Flutter plugin can be installed from:
https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
https://plugins.jetbrains.com/plugin/6351-dart
• Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7249189)
[√] Connected device (2 available)
• sdk gphone x86 (mobile) • emulator-5554 • android-x86 • Android 11 (API
30) (emulator)
• Windows (desktop) • windows • windows-x64 • Microsoft Windows [Version 10.0.19042.1526]
[√] HTTP Host Availability
I tried flutter clean but it is not working. What can I do for this error?
I have fixed this issue from aceta-minophen on github
(https://github.com/flutter/flutter/issues/97086#issuecomment-1029963716)
aceta-minophen solution:
Found the app.so file in ..\build\windows
Copied the file and pasted it in ..\build\windows\runner\Debug\data
[UPDATE]
upgrading flutter to the last version should fix this:
RUN:
flutter upgrade
It seems that problem with this version of Visual Studio
[√] Visual Studio - develop for Windows (Visual Studio Community 2022 17.1.0)
• Visual Studio at C:\Program Files\Microsoft Visual Studio\2022\Community
• Visual Studio Community 2022 version 17.1.32210.238
• Windows 10 SDK version 10.0.22000.0
Try to unintall Visual Studio Community 2022 and install Visual Studio Community 2019
With Visual Studio 2019 all works like a charm :)
I was getting some AOT error wile launching the windows app from vs code , so i downgraded visual studio 2022 to visual studio 2019 and it was working for me
A workaround that also allowed debugging:
edit <proj_dir>\windows\flutter\CMakeLists.txt to replace $<CONFIG> with Debug
There was a single occurrence, near the end of add_custom_command.
This was needed after upgrading VS 2022 to 17.1.0 (it worked fine with 17.0.6).
Windows support for the project was initially added with flutter create --platforms=windows .
VS bug: CMake->vcxproj regression in 17.1.0 when using $ in custom command.
Flutter 2.10.3 resolves this issue.
I stated a fix for the issue on the video here it was simply the app.so being in the wrong folder,
You can watch the video here with full details
Steps to Reproduce
Create a new application.
run flutter run -d windows --debug
Expected results: The build should success.
Actual results: Can't load AOT data from C:\Users\nieti\Desktop\flutter_application_1\build\windows\runner\Debug\data\app.so; no such file. Unable to start engine without AOT data. Failed to create view controller. Error waiting for a debug connection: The log reader stopped unexpectedly, or never started. Error launching application on Windows.
Logs
Did you manage to solve your issue? Im facing this exact issue but flutter doctor shows that everything is OK and Windows is listed on Connected Devices. Im on Flutter 2.10
Hey! I faced the same issue today and I solved this by doing the following:
Found the app.so file in ..\build\windows
Copied the file and pasted it in ..\build\windows\runner\Debug\data
This is a good workaround:
https://stackoverflow.com/a/71216391/9948598
I need to restore CMakeLists.txt to his original state before build for release, but the modified version let me work in debug mode.
I have another solution instead of uninstalling visual Studio 2022 version just modify the the settings inside installer and install the latest version of windows sdk i.e. win sdk 10(10.0.20348.0) and that will solve the problem of app.so hence the AOTdata not found problem
In the image above you can see that the whole dart code is showing white lines and this happened after my laptop accidently turned off while I was running the code.
The first error it gave was corrupted .git/packed-ref file which i fixed but this one isn't going away, other file type is showing their repective color theme only the .dart file is doing this. and also dart analyzer isn't working too
//Flutter doctor -v
[√] Flutter (Channel stable, 2.8.0, on Microsoft Windows [Version 6.3.9600], locale en-US)
• Flutter version 2.8.0 at D:\flutter\Sdk\flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision cf44000065 (8 weeks ago), 2021-12-08 14:06:50 -0800
• Engine revision 40a99c5951
• Dart version 2.15.0
[√] Android toolchain - develop for Android devices (Android SDK version 31.0.0-rc2)
• Android SDK at C:\Users\bright\AppData\Local\Android\sdk
• Platform android-31, build-tools 31.0.0-rc2
• Java binary at: C:\Program Files\Android\Android Studio1\jre\bin\java
• Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b03)
• All Android licenses accepted.
[X] Chrome - develop for the web (Cannot find Chrome executable at .\Google\Chrome\Application\chrome.exe)
! Cannot find Chrome. Try setting CHROME_EXECUTABLE to a Chrome executable.
[√] Android Studio (version 3.5)
• Android Studio at C:\Program Files\Android\Android Studio1
• Flutter plugin version 44.0.1
• Dart plugin version 191.8593
• Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b03)
[√] VS Code (version 1.63.2)
• VS Code at C:\Users\bright\AppData\Local\Programs\Microsoft VS Code
• Flutter extension version 3.34.0
[√] Connected device (1 available)
• Edge (web) • edge • web-javascript • Microsoft Edge 97.0.1072.69
! Doctor found issues in 1 category.
I don't exactly know what the problem is, since it isn't showing me any error. Please what do i do?
I think there is something wrong with the Dart extension (perhaps some files are corrupt), but uninstalling/re-installing it does not remove the files from disk and re-download it.
I would try uninstalling the Dart extension, then go into your %USERPROFILE%\.vscode\extensions folder and delete any dart-code.dart-code folders, and then re-launch VS Code and re-install it.
If that doesn't solve it, please file an issue at https://github.com/Dart-Code/Dart-Code. Thanks!
I have a flutter project I can run with no problems using git terminal and flutter command: flutter run
but I have been facing this problem recently when I try to open the same project using visual studio code,
once vs code starts, It tries to analyze the project for dart code errors. the procedure usually takes a relatively short time (a minute or so) but now It takes forever and I don't know why.
I tried to do flutter clean on my project, but It did not solve it. also tried flutter pub get, still not solving the problem. It is very strange because this is only happening when using visual studio code to open that particular project.
here is a log of flutter doctor -v command :
C:\Users\Rami>flutter doctor -v
[√] Flutter (Channel beta, v1.15.17, on Microsoft Windows [Version 10.0.18363.720], locale en-US)
• Flutter version 1.15.17 at D:\Flutter\sdk
• Framework revision 2294d75bfa (4 weeks ago), 2020-03-07 00:28:38 +0900
• Engine revision 5aff311948
• Dart version 2.8.0 (build 2.8.0-dev.12.0 9983424a3c)
[√] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
• Android SDK at D:\Android\sdk
• Android NDK location not configured (optional; useful for native profiling support)
• Platform android-28, build-tools 28.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_212-release-1586-b04)
• All Android licenses accepted.
[√] Chrome - develop for the web
• Chrome at C:\Program Files (x86)\Google\Chrome\Application\chrome.exe
[√] Android Studio (version 3.6)
• Android Studio at C:\Program Files\Android\Android Studio
• Flutter plugin version 44.0.2
• Dart plugin version 192.7761
• Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b04)
[√] VS Code (version 1.43.2)
• VS Code at C:\Users\Rami\AppData\Local\Programs\Microsoft VS Code
• Flutter extension version 3.8.1
[√] Connected device (3 available)
• SM A520F • 192.168.8.80:5555 • android-arm64 • Android 8.0.0 (API 26)
• Chrome • chrome • web-javascript • Google Chrome 80.0.3987.162
• Web Server • web-server • web-javascript • Flutter Tools
• No issues found!
Your feedback is appreciated,
Thank you
I solved it like here. Enable dart.previewLsp in your settings.
Ctrl + , and enter dart.previewLsp.
Also the problem pops up when I code nested generic types. eg. Future<Either<X, Y>>.
I avoid this as much as possible. You just need to copy the type from another line or use a snippet. Or code it from inside out.
Update
It seems the problem is fixed in recent versions of Dart. Just update your dart installation. Or avoid empty type declarations in generics. eg, Future<List<>>
I know this is too late, but I believe this helps any one stuck with this problem. In my case this is due to a syntax error. I tried commenting most recently edited files and restarted VSCode then this annoying analyzing thing stopped.
Make sure you didn't declare any nested generics and didn't finish the line with your var name like mine
Analyzing for infinite time. 😞
Future<List<>>
Now we are good 😃
Future<List<int>> getMyListOfInt();
Happened to me after upgrading to latest Flutter version (1.20.0). Closing and restarting VSCode fixed it for me.
you can follow these steps. It's work for me
Turn Analyzer logs on and see on what file its slow/stuck, sometimes that file has syntax error that is not handled by analyzer properly (how to turn analyzer logs on).
First column in logs are your system's milliseconds since epoch.
Also enabling dart.previewLsp as mentioned by #loki would help.
Another also, double check that your are not out of memory, the analyzer could be very hungry!
This issue should be cache-related.
You could try removing(do a backup just in case) all visual studio cache-related folders here ~/library/caches, then restart VS and you should be good to go.
This is the naming convention for VS cache folders.
com.microsoft.VSCode
com.microsoft.VSCode.ShipIt