41

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.

Flutter doctor

How can I fix this problem?

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Ahmed Trabelsi
  • 461
  • 1
  • 3
  • 6

9 Answers9

49

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 featuresDesktop development with C++.

Enter image description here

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Rohith Nambiar
  • 2,957
  • 4
  • 17
  • 37
  • 3
    Is visual studio for windows necessary if I want to build or run my flutter app? It seems unnecessary for mobile development – Stephen Murya Apr 23 '22 at 07:47
  • 10
    Yes, for mobile app development its not necessary, but for windows app development its necessary – Rohith Nambiar Apr 23 '22 at 07:49
  • 2
    if VS is not necessary for mobile android apps develop on windows then how can avoid it, but I want to write code in VS code. – Lokendra Parihar Sep 23 '22 at 01:09
  • `Visual Studio` and `Visual studio code` are different, if you want to write Flutter code you can use Visual studio code, If you want to develop Windows apps using Flutter you will need to install a specific tool from `Visual Studio` and then just write code in Visual studio code. – Rohith Nambiar Sep 23 '22 at 03:48
  • 13
    The error can be ignored if you do not want to develop Windows applications using Flutter. – Ajay Oct 03 '22 at 13:17
18

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

  • 3
    This should have way more upvotes! I don't think most developers want to create a Windows app anyways, this should be way more promoted. – Marek Lisý Feb 18 '23 at 18:05
  • Flutter documentation itself starts with Mobile-First development. They should ask during setup whether user wants to develop for Mobile or Develop – Sudhir Kaushik Jun 15 '23 at 23:29
15

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:

  1. MSVC v142 - Visual Studio 2022 C++ x64/86 build tools.
  2. Windows 10 SDK (for Windows 10 users)
  3. C++ CMake tools for Windows.

In total, they should occupy around 8 GB or so.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Daniel Don
  • 232
  • 3
  • 9
9

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

Screenshot

This will not prevent you from developing Mobile apps, but it's a requirement only for Windows Development.

Dani3le_
  • 1,257
  • 1
  • 13
  • 22
2

To build Windows application (exe file), yo don't need install Visual Studio IDE. You can only install Visual Studio Build Tools.

When installing it, remember to select the required package Desktop development with C++ similar when install Visual Studio IDE.

Refer

0

Only two steps are required.

  1. Install Visual Studio 2022 (Link: https://visualstudio.microsoft.com/downloads/)

  2. Install Visual Studio Code (Link: https://code.visualstudio.com/)

Your code will run smoothly.

  • 2
    While this link may answer the question, it is better to include the essential parts of the answer here and provide the link for reference. Link-only answers can become invalid if the linked page changes. - [From Review](/review/late-answers/33068831) – mrgnhnt96 Nov 02 '22 at 22:09
0

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.

exts
  • 9,788
  • 4
  • 19
  • 21
0

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.

-3
  1. Make sure to install Visual Studio Code.

  2. Open the Visual Studio download page:

    Enter image description here

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
  • [Visual Studio Code](https://en.wikipedia.org/wiki/Visual_Studio_Code) is not the same as [Visual Studio](https://en.wikipedia.org/wiki/Microsoft_Visual_Studio). Though it may be the gist of the question. But the confusion should not be in answers. – Peter Mortensen Oct 17 '22 at 12:17