-
Notifications
You must be signed in to change notification settings - Fork 29.1k
Description
Steps to Reproduce
I was using flutter v1.7.10 with desktop embedding for windows. This worked fine but have just upgraded to flutter v1.12.13+hotfix.5. I am using flutter desktop embedding. I already had this installed (and working) with flutter v1.7.10. When I run flutter run
in vs code or from the command prompt, there is no problem and everything runs as expected. However, if I go to the build
folder that is created and run the [PROJECT_NAME].exe
it runs differently.
Specifically, flutter and its layout are all the same and works properly. However, a cmd window pops up after the project has been created. To be clear, this is NOT a console that is connected to the output of the flutter project. Nothing is printed out and it immediately closes after about a second. This is not an issue of hiding the cmd window on startup, since the Runner.sln project has wWinMain as it's entry point. Rather, every time a process (I'm assuming) is started somewhere in the project (I create them at various points) it opens a visible cmd window when it shouldn't be visible). Furthermore, all cmd windows pop up only after the flutter renders to the screen.
Thus, my steps loosely are:
- Set up flutter desktop embedding for windows
- Run
flutter run
(windows is the only device) (I also tried building from vs studio manually) - Run the generated .exe file
The only modifications I made were resizing the window, renaming the title and giving it a new icon.
Target Platform: Windows
Target OS version/browser: Windows 10.0.18362.535 x64
Devices: Windows
Logs
I'm not sure what log I would post since there is no error and the project seems to build properly. Rather, the cmd pops up after the application has started and during certain other events. I'm happy to post any logs like build, etc if needed.
flutter doctor -v:
[√] Flutter (Channel unknown, v1.12.13+hotfix.5, on Microsoft Windows [Version 10.0.18362.535], locale en-US)
• Flutter version 1.12.13+hotfix.5 at C:\Users\isaac\Desktop\slate\flutter_sdk\flutter
• Framework revision 27321ebbad (2 weeks ago), 2019-12-10 18:15:01 -0800
• Engine revision 2994f7e1e6
• Dart version 2.7.0
[√] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
• Android SDK at C:\Users\isaac\AppData\Local\Android\sdk
• Android NDK location not configured (optional; useful for native profiling support)
• Platform android-28, build-tools 28.0.3
• Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1136-b06)
• All Android licenses accepted.
[√] Visual Studio - develop for Windows (Visual Studio Community 2017 15.9.12)
• Visual Studio at C:\Program Files (x86)\Microsoft Visual Studio\2017\Community
• Visual Studio Community 2017 version 15.9.28307.665
[√] Android Studio (version 3.2)
• Android Studio at C:\Program Files\Android\Android Studio
• Flutter plugin version 31.3.1
• Dart plugin version 181.5656
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1136-b06)
[√] IntelliJ IDEA Community Edition (version 2018.3)
• IntelliJ at C:\Program Files\JetBrains\IntelliJ IDEA Community Edition 2018.3.2
• Flutter plugin version 33.3.2
• Dart plugin version 183.5901
[√] VS Code (version 1.41.1)
• VS Code at C:\Users\isaac\AppData\Local\Programs\Microsoft VS Code
• Flutter extension version 3.7.1
[√] Connected device (1 available)
• Windows • Windows • windows-x64 • Microsoft Windows [Version 10.0.18362.535]
• No issues found!
Things I tried:
Creating a separate project and spawning from that:
I created a separate project and had it simply start the flutter created .exe (hiding the cmd window). This didn't work (as I expected) since the cmd pops up after flutter renders and is not part of the startup (I believe).
Modifying the Runner.sln files:
I tried a variety of things to hide and modify the like calling functions like:
::ShowWindow(::GetConsoleWindow(), SW_HIDE);
In various locations to try and find where the process was created, but only in the wWinMain
function so I believe it must be spawned further down during runtime. This belief is supported by the fact that as I interact with my flutter application if I do anything that creates a process is pops up a new cmd (which then also disappears when done).