Search code examples
windowsflutterdartflutter-windows

Error "Target file "windows" not found." when I start windows application in debug mode


"Target file "windows" not found." error after "flutter run windows".

All project dependencies:

cupertino_icons: ^1.0.2
firebase_core: ^2.13.1
sliding_up_panel: ^2.0.0+1
flutter_slidable: ^2.0.0
just_audio: ^0.9.32
flutter_modular: ^5.0.3
url_strategy: ^0.2.0
audio_service: ^0.18.0
audio_video_progress_bar: ^1.0.1
get_it: ^7.6.0
audio_session: ^0.1.13
just_audio_windows: ^0.2.0
window_manager: ^0.3.4
google_fonts: ^4.0.4

This is doctor -v:

[√] Flutter (Channel main, 3.12.0-2.0.pre.9, on Microsoft Windows [Version 10.0.22000.2057], locale ru-RU)
    • Flutter version 3.12.0-2.0.pre.9 on channel main at D:\Flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 96afa500db (3 weeks ago), 2023-06-07 04:52:17 +0000
    • Engine revision 59d5444cf0
    • Dart version 3.1.0 (build 3.1.0-163.0.dev)
    • DevTools version 2.24.0

[√] Windows Version (Installed version of Windows is version 10 or higher)

[√] Android toolchain - develop for Android devices (Android SDK version 33.0.1)
    • Android SDK at C:\Users\User\AppData\Local\Android\Sdk
    • Platform android-33, build-tools 33.0.1
    • Java binary at: D:\AndroidStudio\jbr\bin\java
    • Java version OpenJDK Runtime Environment (build 11.0.15+0-b2043.56-9505619)
    • All Android licenses accepted.

[√] Chrome - develop for the web
    • Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe

[√] Visual Studio - develop Windows apps (Visual Studio Community 2022 17.6.4)
    • Visual Studio at C:\Program Files\Microsoft Visual Studio\2022\Community
    • Visual Studio Community 2022 version 17.6.33815.320
    • Windows 10 SDK version 10.0.22000.0

[√] Android Studio (version 2022.1)
    • Android Studio at D:\AndroidStudio
    • 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.15+0-b2043.56-9505619)

[√] VS Code, 64-bit edition (version 1.76.2)
    • VS Code at C:\Program Files\Microsoft VS Code
    • Flutter extension version 3.66.0

[√] Connected device (3 available)
    • Windows (desktop) • windows • windows-x64    • Microsoft Windows [Version 10.0.22000.2057]
    • Chrome (web)      • chrome  • web-javascript • Google Chrome 114.0.5735.199
    • Edge (web)        • edge    • web-javascript • Microsoft Edge 114.0.1823.58

[√] Network resources
    • All expected network resources are available.

• No issues found!

This is flutter run windows:

Target file "windows" not found.

And this is flutter run -v windows:

[   +3 ms] executing: [D:\Flutter/] git -c log.showSignature=false log -n 1 --pretty=format:%H
[ +144 ms] Exit code 0 from: git -c log.showSignature=false log -n 1 --pretty=format:%H
[   +2 ms] 96afa500dbf1f185616cea3f48de429675cd3274
[   +1 ms] executing: [D:\Flutter/] git tag --points-at 96afa500dbf1f185616cea3f48de429675cd3274
[ +228 ms] Exit code 0 from: git tag --points-at 96afa500dbf1f185616cea3f48de429675cd3274
[   +2 ms] executing: [D:\Flutter/] git describe --match *.*.* --long --tags 96afa500dbf1f185616cea3f48de429675cd3274
[ +299 ms] Exit code 0 from: git describe --match *.*.* --long --tags 96afa500dbf1f185616cea3f48de429675cd3274
[   +1 ms] 3.12.0-1.0.pre-9-g96afa500db
[   +5 ms] executing: [D:\Flutter/] git symbolic-ref --short HEAD
[ +251 ms] Exit code 0 from: git symbolic-ref --short HEAD
[   +1 ms] main
[ +102 ms] executing: [D:\Flutter/] git rev-parse --abbrev-ref --symbolic @{upstream}
[ +180 ms] Exit code 0 from: git rev-parse --abbrev-ref --symbolic @{upstream}
[   +2 ms] origin/main
[   +2 ms] executing: [D:\Flutter/] git ls-remote --get-url origin
[ +184 ms] Exit code 0 from: git ls-remote --get-url origin
[   +3 ms] https://github.com/flutter/flutter.git
[ +297 ms] Artifact Instance of 'AndroidGenSnapshotArtifacts' is not required, skipping update.
[   +3 ms] Artifact Instance of 'AndroidInternalBuildArtifacts' is not required, skipping update.
[   +1 ms] Artifact Instance of 'IOSEngineArtifacts' is not required, skipping update.
[   +1 ms] Artifact Instance of 'FlutterWebSdk' is not required, skipping update.
[        ] Artifact Instance of 'LegacyCanvasKitRemover' is not required, skipping update.
[  +16 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.
[   +1 ms] Artifact Instance of 'MacOSFuchsiaSDKArtifacts' is not required, skipping update.
[   +2 ms] Artifact Instance of 'FlutterRunnerSDKArtifacts' is not required, skipping update.
[   +3 ms] Artifact Instance of 'FlutterRunnerDebugSymbols' is not required, skipping update.
[ +147 ms] executing: C:\Users\User\AppData\Local\Android\Sdk\platform-tools\adb.exe devices -l
[  +95 ms] List of devices attached
[  +13 ms] Artifact Instance of 'AndroidGenSnapshotArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'AndroidInternalBuildArtifacts' is not required, skipping update.
[   +1 ms] Artifact Instance of 'IOSEngineArtifacts' is not required, skipping update.
[  +28 ms] 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.
[ +115 ms] "flutter run" took 508ms.
[  +35 ms] Target file "windows" not found.
[   +5 ms] 
           #0      FlutterCommand.validateCommand (package:flutter_tools/src/runner/flutter_command.dart:1610:9)
           #1      RunCommand.validateCommand (package:flutter_tools/src/commands/run.dart:532:19)
           #2      FlutterCommand.verifyThenRunCommand (package:flutter_tools/src/runner/flutter_command.dart:1481:11)
           <asynchronous suspension>
           #3      FlutterCommand.run.<anonymous closure> (package:flutter_tools/src/runner/flutter_command.dart:1297:27)
           <asynchronous suspension>
           #4      AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:19)
           <asynchronous suspension>
           #5      CommandRunner.runCommand (package:args/command_runner.dart:212:13)
           <asynchronous suspension>
           #6      FlutterCommandRunner.runCommand.<anonymous closure> (package:flutter_tools/src/runner/flutter_command_runner.dart:336:9)
           <asynchronous suspension>
           #7      AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:19)
           <asynchronous suspension>
           #8      FlutterCommandRunner.runCommand (package:flutter_tools/src/runner/flutter_command_runner.dart:284:5)
           <asynchronous suspension>
           #9      run.<anonymous closure>.<anonymous closure> (package:flutter_tools/runner.dart:115:9)
           <asynchronous suspension>
           #10     AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:19)
           <asynchronous suspension>
           #11     main (package:flutter_tools/executable.dart:91:3)
           <asynchronous suspension>


[ +275 ms] ensureAnalyticsSent: 256ms
[   +1 ms] Running 0 shutdown hooks
[   +1 ms] Shutdown hooks complete
[   +5 ms] exiting with code 1

I work in VS Code and after run program using F5 all stack on Launching lib\main.dart on Windows in debug mode...

I have tried reinstalling visual studio components, changing flutter channels but nothing helps.


Solution

  • I had the same problem and finally found the error.

    I know it's late but the correct command to run a windows desktop app is:

    flutter run -d windows