'Flutter Error when trying to debug Windows App

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?



Solution 1:[1]

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

Solution 2:[2]

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 :)

Solution 3:[3]

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

Solution 4:[4]

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.

Solution 5:[5]

Flutter 2.10.3 resolves this issue.

Solution 6:[6]

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

Solution 7:[7]

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

Solution 8:[8]

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.

Solution 9:[9]

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

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1
Solution 2
Solution 3 Ashish Shenoy
Solution 4
Solution 5 Cristian Echeverría
Solution 6 Scott Lexium
Solution 7 YassineDev
Solution 8 Cristian Echeverría
Solution 9 Devrohit