A brand new Flutter Project created in VSCode throws the above error when I try to run it on Windows. Detailed steps to reproduce below:
I created a new default Flutter application in VSCode.
I ran flutter config --enable-windows-desktop
I ran flutter devices.
Windows (desktop) • windows • windows-x64 • Microsoft Windows [Version 10.0.19043.1766] Chrome (web) • chrome • web-javascript • Google Chrome 103.0.5060.66 Edge (web) • edge • web-javascript • Microsoft Edge 103.0.1264.44
I ran the app in Vscode without debugging and chose Enable Windows for this Project.
It reported the error below.
flutter create --platforms windows . The "--platforms" argument is not supported in module template. exit code 2
flutter doctor output:
Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel stable, 3.0.4, on Microsoft Windows [Version 10.0.19043.1766], locale en-GB)
[√] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
[√] Chrome - develop for the web
[√] Visual Studio - develop for Windows (Visual Studio Community 2022 17.0.6)
[√] Android Studio (version 4.2)
[√] VS Code (version 1.68.1)
[√] Connected device (3 available)
[√] HTTP Host Availability
• No issues found!
Edit: I recreated the applitaion from the command line and it ran through without problems. Looks like whatever the problem is, it's coming from VSCode
Related
Please see flutter doctor output below. I am not sure how to fix the issue under android studio.
Everything is latest and fresh installed.
Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel stable, 3.3.10, on Microsoft Windows [Version 10.0.19044.2486], locale en-US)
[√] Android toolchain - develop for Android devices (Android SDK version 29.0.3)
[√] Chrome - develop for the web
[√] Visual Studio - develop for Windows (Visual Studio Build Tools 2019 16.11.22)
[!] Android Studio (version 2022.1)
X Unable to find bundled Java version.
[√] VS Code (version 1.74.3)
[√] Connected device (3 available)
[√] HTTP Host Availability
Flutter doctor -v
Flutter (Channel stable, 3.3.10, on Microsoft Windows [Version 10.0.19044.2486], locale en-US)
• Flutter version 3.3.10 on channel stable at C:\src\flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 135454af32 (4 weeks ago), 2022-12-15 07:36:55 -0800
• Engine revision 3316dd8728
• Dart version 2.18.6
• DevTools version 2.15.0
[√] Android toolchain - develop for Android devices (Android SDK version 29.0.3)
• Android SDK at C:\Users\rupena\AppData\Local\Android\sdk
• Platform android-29, build-tools 29.0.3
• Java binary at: C:\Program Files (x86)\Java\jre1.8.0_271\bin\java
• Java version Java(TM) SE Runtime Environment (build 1.8.0_271-b09)
• All Android licenses accepted.
[√] Chrome - develop for the web
• Chrome at C:\Program Files (x86)\Google\Chrome\Application\chrome.exe
[√] Visual Studio - develop for Windows (Visual Studio Build Tools 2019 16.11.22)
• Visual Studio at C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools
• Visual Studio Build Tools 2019 version 16.11.33130.400
• Windows 10 SDK version 10.0.19041.0
[!] Android Studio (version 2022.1)
• 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
X Unable to find bundled Java version.
• Try updating or re-installing Android Studio.
[√] VS Code (version 1.74.3)
• VS Code at C:\Users\rupena\AppData\Local\Programs\Microsoft VS Code
• Flutter extension version 3.32.0
[√] Connected device (3 available)
• Windows (desktop) • windows • windows-x64 • Microsoft Windows [Version 10.0.19044.2486]
• Chrome (web) • chrome • web-javascript • Google Chrome 108.0.5359.126
• Edge (web) • edge • web-javascript • Microsoft Edge 108.0.1462.76
[√] HTTP Host Availability
• All required HTTP hosts are available
I tried updating Android studio. I also checked JAVA environment variable value and I do have that path in the system.
JAVA_HOME is C:\Program Files (x86)\Java\jre1.8.0_271 in the environment variable.
Post here was helpful to solve the issue: https://github.com/flutter/flutter/issues/118502
Flutter [!] Android Studio (version 2022.1) X Unable to find bundled Java version
To add, perhaps this will help you in resolving your issue with the same question posted.
I am using the flutter package flutter_background_service
https://pub.dev/packages/flutter_background_service/example
when the app is resuming, I have this infinite message
Tried to send a platform message to Flutter, but FlutterJNI was detached from native C++. Could not send. Channel: plugins.flutter.io/sensors/accelerometer. Response ID XXXX
Flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 2.10.2, on Microsoft Windows [version 10.0.19042.1526], locale fr-CD)
[✓] Android toolchain - develop for Android devices (Android SDK version 31.0.0)
[✓] Chrome - develop for the web
[✓] Visual Studio - develop for Windows (Visual Studio Build Tools 2019 16.9.4)
[✓] Android Studio (version 2020.3)
[✓] Android Studio (version 2021.1)
[✓] VS Code (version 1.64.2)
[✓] Connected device (3 available)
[✓] HTTP Host Availability
• No issues found!
You can see this post and this issue.
But unfortunately it's not fixed yet. Maybe this is a bug.
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 recently updated my android studio to Arctic fox(2020.3.1) and got the following problem when running "flutter doctor".
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 2.2.3, on Microsoft Windows [Version 10.0.22000.160], locale en-IN)
[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.1)
[✓] Chrome - develop for the web
[!] Android Studio (version 4.0)
✗ Unable to determine bundled Java version.
[✓] IntelliJ IDEA Community Edition (version 2020.1)
[✓] VS Code (version 1.59.1)
[✓] Connected device (2 available)
I have referred to several previous posts but none of them fix my issue.
Thank you in advance!!
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.