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
Related
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
I want to debug the flutter demo application on windows x64 device.but it always fails with 1 error and 1 warning this is my Debug console :
Launching lib\main.dart on Windows in debug mode...
lib\main.dart:1
F:\flut\flutter_application_5\windows\runner\utils.cpp(52,43): error C2220: warning treated as error - no 'object' file generated [F:\flut\flutter_application_5\build\windows\runner\flutter_application_5.vcxproj]
F:\flut\flutter_application_5\windows\runner\utils.cpp(52,43): warning C4018: '>': signed/unsigned mismatch [F:\flut\flutter_application_5\build\windows\runner\flutter_application_5.vcxproj]
Exception: Build process failed.
and here is my flutter doctor log :
[flutter] flutter doctor -v
[√] Flutter (Channel stable, 3.0.5, on Microsoft Windows [Version 10.0.19044.1826], locale en-US)
• Flutter version 3.0.5 at C:\src\flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision f1875d570e (6 weeks ago), 2022-07-13 11:24:16 -0700
• Engine revision e85ea0e79c
• Dart version 2.17.6
• DevTools version 2.12.2
[√] Android toolchain - develop for Android devices (Android SDK version 33.0.0)
• Android SDK at C:\Users\MEMPHIS\AppData\Local\Android\sdk
• Platform android-33, build-tools 33.0.0
• Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
• Java version OpenJDK Runtime Environment (build 11.0.12+7-b1504.28-7817840)
• 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 Enterprise 2019 16.1.0)
• Visual Studio at C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise
• Visual Studio Enterprise 2019 version 16.1.28917.181
• Windows 10 SDK version 10.0.17763.0
[√] Android Studio (version 2021.2)
• 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.12+7-b1504.28-7817840)
[√] VS Code (version 1.70.2)
• VS Code at C:\Users\MEMPHIS\AppData\Local\Programs\Microsoft VS Code
• Flutter extension version 3.46.0
[√] Connected device (3 available)
• Windows (desktop) • windows • windows-x64 • Microsoft Windows [Version 10.0.19044.1826]
• Chrome (web) • chrome • web-javascript • Google Chrome 104.0.5112.102
• Edge (web) • edge • web-javascript • Microsoft Edge 104.0.1293.63
[√] HTTP Host Availability
• All required HTTP hosts are available
• No issues found!
exit code 0
I can debug the demo app on edge, chrome, android without any problem
so What wrong?
The (Microsoft) C++ compiler is raising a warning inside the utils.cpp file:
windows\runner\utils.cpp(52,43): warning C4018: '>': signed/unsigned mismatch
It's configured to treat warnings as errors, so the compile fails with:
windows\runner\utils.cpp(52,43): error C2220: warning treated as error - no 'object' file generated
I don't believe that /WX (warnings as errors) can be configured other than by the build script (which turns it ON).
I suspect one of two things:
The Enterprise edition of the compiler (which you have) is slightly more picky than the Community edition (which I have). You could edit the project file to turn off warnings-as-errors, or add an exception for this warning (more below).
Your compiler needs upgrading. I've got 16.11.something; you've got 16.1.something. Run the Visual Studio Installer again to upgrade it. (For example: I just ran it, and it's suggesting I upgrade from 16.11.10 to 16.11.18...).
Editing the project file
The winapp.vcxproj project file is (apparently) generated by CMake. Edit windows\CMakeLists.txt and change the following line:
target_compile_options(${TARGET} PRIVATE /W4 /WX /wd"4100")
Make it look like this:
target_compile_options(${TARGET} PRIVATE /W4 /WX /wd"4100" /wd4018)
I don't know where the quotes come from; you might need them. Alternatively, remove the /WX bit.
I am trying to use google authentication to log in to my app. Previously, I had this code running perfectly on my other laptop, but now that I have moved the same code and setup to another machine I am facing issues.
I have added SHA1 and SHA256 keys into my firebase, added the google-services.json file in my app folder. Currently, when I click my button to sign in with google, it shows me my account and let's me click it. However, upon clicking, it automatically redirects me to the messages_codecs.dart file and highlights this line throw PlatformException(code: errorCode, message: errorMessage as String?, details: errorDetails, stacktrace: errorStacktrace);
I was initially facing this identical error upon clicking on my sign in button, but then realized I was not using a AVM with google play store enabled. After changing that, it brings me through the sign in process, but after gives the same error.
You can find my whole file structure here. It is inside this question - StreamBuilder issue - snapshot.connectionState == ConnectionState.waiting when a TextFormField widget is clicked.,
I have searched and tried every solution online but nothing seems to work
Here is my flutter doctor -v
[√] Flutter (Channel master, 3.1.0-0.0.pre.966, on Microsoft Windows [Version 10.0.22000.613], locale en-US)
• Flutter version 3.1.0-0.0.pre.966 at C:\Users\aryan\flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision df52b510ca (18 hours ago), 2022-05-27 06:13:06 -0400
• Engine revision 436f18b5a2
• Dart version 2.18.0 (build 2.18.0-149.0.dev)
• DevTools version 2.13.1
[√] Android toolchain - develop for Android devices (Android SDK version 32.1.0-rc1)
• Android SDK at C:\Users\aryan\AppData\Local\Android\sdk
• Platform android-32, build-tools 32.1.0-rc1
• Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
• Java version OpenJDK Runtime Environment (build 11.0.12+7-b1504.28-7817840)
• 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 Community 2019 16.7.5)
• Visual Studio at C:\Program Files (x86)\Microsoft Visual Studio\2019\Community
• Visual Studio Community 2019 version 16.7.30523.141
• Windows 10 SDK version 10.0.18362.0
X Visual Studio is missing necessary components. Please re-run the Visual Studio installer for the "Desktop development with C++" workload, and include these components:
MSVC v142 - VS 2019 C++ x64/x86 build tools
- If there are multiple build tool versions available, install the latest
C++ CMake tools for Windows
Windows 10 SDK
[√] Android Studio (version 2021.2)
• 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.12+7-b1504.28-7817840)
[√] VS Code (version 1.67.2)
• VS Code at C:\Users\aryan\AppData\Local\Programs\Microsoft VS Code
• Flutter extension version 3.40.0
[√] Connected device (4 available)
• sdk gphone x86 (mobile) • emulator-5554 • android-x86 • Android 11 (API 30) (emulator)
• Windows (desktop) • windows • windows-x64 • Microsoft Windows [Version 10.0.22000.613]
• Chrome (web) • chrome • web-javascript • Google Chrome 102.0.5005.61
• Edge (web) • edge • web-javascript • Microsoft Edge 101.0.1210.53
[√] HTTP Host Availability
• All required HTTP hosts are available
! Doctor found issues in 1 category.
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
Why do I get these VS Code errors after running flutter doctor:
Waiting for another flutter command to release the startup lock...
Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel beta, v0.5.1, on Microsoft Windows [Version 10.0.17134.112], locale hu-HU)
[√] Android toolchain - develop for Android devices (Android SDK 28.0.0)
[√] Android Studio (version 3.1)
[!] VS Code, 32-bit edition
[!] VS Code, 64-bit edition (version 1.24.1)
[!] Connected devices
! No devices available
! Doctor found issues in 3 categories.
exit code 0
The current release of flutter does not properly detect the VSC extension because of case sensitivity errors. If it shows up in VSCode, it's installed. Ignore Flutter Doctor. :)
There could be several reasons for this, but the most likely cause is that you have VS Code installed but not the Flutter extension.
I get the same:
Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel dev, v0.5.4, on Microsoft Windows [Version 10.0.17134.112], locale en-GB)
[√] Android toolchain - develop for Android devices (Android SDK 27.0.3)
[√] Android Studio (version 3.1)
[√] IntelliJ IDEA Community Edition (version 2017.2)
[√] IntelliJ IDEA Community Edition (version 2018.1)
[!] VS Code, 32-bit edition
[!] VS Code, 64-bit edition (version 1.22.2)
[!] Connected devices
! No devices available
! Doctor found issues in 3 categories.
Run flutter doctor -v for more details as it tells you to in the error message:
[√] Flutter (Channel dev, v0.5.4, on Microsoft Windows [Version 10.0.17134.112], locale en-GB)
• Flutter version 0.5.4 at C:\VirtualDrives\Programs\flutter
• Framework revision 3019ad976d (11 days ago), 2018-06-11 11:31:25 -0700
• Engine revision d33bbff470
• Dart version 2.0.0-dev.60.0.flutter-a5e41681e5
[√] Android toolchain - develop for Android devices (Android SDK 27.0.3)
• Android SDK at C:\VirtualDrives\Programs\Android\sdk
• Android NDK location not configured (optional; useful for native profiling support)
• Platform android-27, build-tools 27.0.3
• ANDROID_HOME = C:\VirtualDrives\Programs\Android\sdk
• Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1024-b02)
• All Android licenses accepted.
[√] Android Studio (version 3.1)
• Android Studio at C:\Program Files\Android\Android Studio
• Flutter plugin version 25.0.1
• Dart plugin version 173.4700
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1024-b02)
[√] IntelliJ IDEA Community Edition (version 2017.2)
• IntelliJ at C:\Program Files (x86)\JetBrains\IntelliJ IDEA Community Edition 2017.1
• Flutter plugin version 19.1
• Dart plugin version 172.4343.25
[√] IntelliJ IDEA Community Edition (version 2018.1)
• IntelliJ at C:\Program Files\JetBrains\IntelliJ IDEA Community Edition 2018.1
• Flutter plugin version 25.0.2
• Dart plugin version 181.4892.1
[!] VS Code, 32-bit edition
• VS Code at C:\Program Files (x86)\Microsoft VS Code
• Flutter extension not installed; install from
https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter
[!] VS Code, 64-bit edition (version 1.22.2)
• VS Code at C:\Program Files\Microsoft VS Code
• Flutter extension not installed; install from
https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter
[!] Connected devices
! No devices available
! Doctor found issues in 3 categories.