Can not run Flutter project on Windows because CMake Error - flutter

I want to run flutter app on windows 10, I installed Visual Studio and Android Studio, The app is working fine on mobile, but when it's running on Windows platform I faced this problem:
CMake Error at CMakeLists.txt:2 (project):
Generator
Visual Studio 16 2019
could not find any instance of Visual Studio.
Flutter doctor has not any problem:
My Visual Studio version is 2022 which downloaded from
https://visualstudio.microsoft.com/downloads
CMake had installed and added into Path env.
How Can I solve this problem?
Thank you

You need to instal Visual Studio 2019, because Visual Studio 2022 is/was not supported.

Related

Issue found after running flutter doctor command: "Please install the "Desktop development with C++" Is it necessary to resolve this issue?

I am getting this issue when I run flutter doctor
Visual Studio - develop for Windows (Visual Studio Build Tools 2017 15.9.47)
X Visual Studio 2019 or later is required.
Download at https://visualstudio.microsoft.com/downloads/.
Please install the "Desktop development with C++" workload, including all of its default components
Is it necessary for me to solve the above issue before I can run flutter on my android studio?
Is it necessary for me to solve the above issue before I can run flutter on my android studio?
No. This is only necessary to solve this issue if you want to develop Windows apps as it requires Visual Studio to be installed.
If you want to solve this issue. Download Visual Studio and when installing, under the "Workloads" tab, click on "Desktop development with C++".
This is not needed to run flutter on android studio. The only reason it's needed is for windows development with flutter, so if you're not going to take that path then there is no need to install VS Studio.

Visual Studio not installed and Install Desktop Development with C++ [duplicate]

My Flutter Doctor is saying:
Visual Studio - develop for Windows
X Visual Studio not installed; this is necessary for Windows development.
Download at https://visualstudio.microsoft.com/downloads/.
Please install the "Desktop development with C++" workload, including all
of its default components.
How can I fix this problem?
It's basically saying that if you want to develop your Flutter application for Windows you will need to install Visual Studio 2022 and while installing Visual Studio 2022 you will need to download this: Desktop development with C++
Also, you have to install the third link in this: Visual-studio
You could also get desktop development with the C++ tool after installing Visual Studio and then navigating to tool → Get tools and features → Desktop development with C++.
The error means install Visual Studio, and this is different from Visual Studio Code. It's an IDE from Microsoft.
For those who may be using a weak computer and can't afford to install the full Visual Studio, you only need to install a few components from Visual Studio to get Flutter to run on your computer without errors. These components are:
MSVC v142 - Visual Studio 2022 C++ x64/86 build tools.
Windows 10 SDK (for Windows 10 users)
C++ CMake tools for Windows.
In total, they should occupy around 8 GB or so.
As it states, you need to download Visual Studio (which is different from Visual Studio Code).
When installing it, remember to select the required package Desktop development with C++:
This will not prevent you from developing Mobile apps, but it's a requirement only for Windows Development.
Is unnecessary to install the "Desktop development with C++" if you don't want to develop desktop applications for Windows using Flutter.
If you only want to develop mobile apps using Flutter, you can run
flutter config --no-enable-windows-desktop
to disable the desktop support for your Flutter projects. After that, when you run the flutter doctor command again, you will no longer see the warning.
Read more at: https://fig.io/manual/flutter/config
Only two steps are required.
Install Visual Studio 2022 (Link: https://visualstudio.microsoft.com/downloads/)
Install Visual Studio Code (Link: https://code.visualstudio.com/)
Your code will run smoothly.
My solution was a bit simpler. Uninstall everything all build system's from VS. Then reinstall Visual Studio Community 2022, restart then try again. Might get a warning about nuget but it should fix the issue.
With the newest android installer "android-studio-2022.1.1.19-windows" there would be a jbr and jre folder existing, hence creating a link from jre to jbr would not work.
What you can do is copy the contents of the items in jbr into the jre folder and this would resolve the error.
Make sure to install Visual Studio Code.
Open the Visual Studio download page:

found some error in setup flutter, how can i solve this?

I setup flutter for app development and vs code is already install in my device. still display this error, how can i solve this error?
[X] Visual Studio - develop for Windows
X Visual Studio not installed; this is necessary for Windows development.
Download at https://visualstudio.microsoft.com/downloads/.
Please install the "Desktop development with C++" workload, including all of its default components
[!] Android Studio (not installed)
[√] VS Code (version 1.67.0)
You're fine to build mobile apps, the error is just letting you know that your flutter is not yet configured for desktop app development on windows.
Development on windows needs you to install Visual Studio which is different from Visual Studio Code.
So you're fine.
If you want to stop the error just go ahead and download and setup Visual Studio for desktop app development.

Visual Studio not installed; this is necessary for Windows development

My Flutter Doctor is saying:
Visual Studio - develop for Windows
X Visual Studio not installed; this is necessary for Windows development.
Download at https://visualstudio.microsoft.com/downloads/.
Please install the "Desktop development with C++" workload, including all
of its default components.
How can I fix this problem?
It's basically saying that if you want to develop your Flutter application for Windows you will need to install Visual Studio 2022 and while installing Visual Studio 2022 you will need to download this: Desktop development with C++
Also, you have to install the third link in this: Visual-studio
You could also get desktop development with the C++ tool after installing Visual Studio and then navigating to tool → Get tools and features → Desktop development with C++.
The error means install Visual Studio, and this is different from Visual Studio Code. It's an IDE from Microsoft.
For those who may be using a weak computer and can't afford to install the full Visual Studio, you only need to install a few components from Visual Studio to get Flutter to run on your computer without errors. These components are:
MSVC v142 - Visual Studio 2022 C++ x64/86 build tools.
Windows 10 SDK (for Windows 10 users)
C++ CMake tools for Windows.
In total, they should occupy around 8 GB or so.
As it states, you need to download Visual Studio (which is different from Visual Studio Code).
When installing it, remember to select the required package Desktop development with C++:
This will not prevent you from developing Mobile apps, but it's a requirement only for Windows Development.
Is unnecessary to install the "Desktop development with C++" if you don't want to develop desktop applications for Windows using Flutter.
If you only want to develop mobile apps using Flutter, you can run
flutter config --no-enable-windows-desktop
to disable the desktop support for your Flutter projects. After that, when you run the flutter doctor command again, you will no longer see the warning.
Read more at: https://fig.io/manual/flutter/config
Only two steps are required.
Install Visual Studio 2022 (Link: https://visualstudio.microsoft.com/downloads/)
Install Visual Studio Code (Link: https://code.visualstudio.com/)
Your code will run smoothly.
My solution was a bit simpler. Uninstall everything all build system's from VS. Then reinstall Visual Studio Community 2022, restart then try again. Might get a warning about nuget but it should fix the issue.
With the newest android installer "android-studio-2022.1.1.19-windows" there would be a jbr and jre folder existing, hence creating a link from jre to jbr would not work.
What you can do is copy the contents of the items in jbr into the jre folder and this would resolve the error.
Make sure to install Visual Studio Code.
Open the Visual Studio download page:

Visual Studio Code Installed twice, how to uninstall completely?

I installed Visual Studio Code 1.14.2 first. Then I installed Visual Studio Code 1.15.1(the 2nd Installation) again without uninstall the previous version (I forgot!). The 2nd Installation(the Visual Studio Code 1.15.1) still done successfully. The installed software shows the 2nd software(Visual Studio Code 1.15.1)
I uninstalled the 2nd Installation(Visual Studio Code 1.15.1). After uninstallation, I tried to install Visual Studio Code 1.15.1(The 2nd) again. But this installation process becomes wired: I don't need to install this software, the installation process did not execute. I can directly launch(open) the software without installing the software. Just like the portable version that it does not need installation. ** Visual Studio Code 1.15.1(the 2nd) runs normally**. When I launch(open) the software of Visual Studio Code 1.15.1
Control Panel\Programs\Programs and Features\the Installed Products list
Visual Studio Code 1.15.1(the 2nd) is still not on this Installed Products list.
Any uninstall tool suggestion?
My computer is Windows 10.1 Pro upgraded from Win 8.1 My computer uninstalled Visual Studio 2017 before. Thank you very much!