Sub topic 3
Checking your setup with flutter doctor
flutter doctor is the command that tells you whether your machine can build and run Flutter apps. It inspects the SDK, the platform toolchains, your editors, and your connected devices. It then prints a checklist with a suggested fix for each problem it finds. This chapter explains how to read that checklist and which fixes are routine.
This chapter assumes you have already installed the Flutter SDK and added its bin directory to your PATH. It also assumes you are comfortable running commands in a terminal and know where your OS keeps environment variables.
What flutter doctor checks
flutter doctor runs a set of validators. Each one checks one part of your environment and reports a result. Which validators appear depends on your operating system. For example, Xcode appears only on macOS, and Visual Studio appears only on Windows.
| Section | What it verifies | Appears on |
|---|---|---|
| Flutter | SDK version, channel, Dart version, and the `flutter` binary on your `PATH` | All |
| Android toolchain | Android SDK, platform tools, command-line tools, accepted licenses, and a usable Java runtime | All |
| Xcode | Xcode installation, command-line tools, and CocoaPods | macOS |
| Chrome | A browser that Flutter can launch for web development | All |
| Visual Studio | Desktop C++ workload for Windows builds | Windows |
| Linux toolchain | Compiler and libraries for Linux desktop builds, such as clang, CMake, Ninja, and GTK | Linux |
| Android Studio, VS Code | Editor installs and their Flutter and Dart plugins | All |
| Connected device | Devices and targets Flutter can currently run on | All |
| Network resources | Whether the tool can reach the hosts it downloads from | All |
You do not need every section to be green. A Windows developer who only targets Android can ignore a missing Xcode section, because Xcode is never listed there. What matters is that the sections for the platforms you plan to target pass.
Running the checks
Start with the version, then the doctor, then the device list. These are the three commands from the setup workflow:
flutter --version
flutter doctor
flutter devicesflutter --version confirms that your shell finds the SDK you expect. If it fails with "command not found", the problem is your PATH, not Flutter. flutter devices shows only what Flutter can run on right now. The "Connected device" line in flutter doctor is a summary of the same list.
The first time you run any Flutter command after installing, the tool may download the Dart SDK and other artifacts. That first run can take a few minutes.
Reading the output
Here is an example of a partly configured machine. Your version numbers and paths will differ.
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.x.x, on macOS 14.x, locale en-US)
[!] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
✗ Android license status unknown.
Run `flutter doctor --android-licenses` to accept the SDK licenses.
[✓] Xcode - develop for iOS and macOS (Xcode 15.x)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2023.x)
[✓] VS Code (version 1.x)
[✓] Connected device (3 available)
[✓] Network resources
! Doctor found issues in 1 category.Each line starts with a status marker:
[✓]means the section passed.[!]means the section works in part. Something optional is missing, or a problem exists that you can probably fix quickly.[✗]means a required piece is missing or broken, and builds for that platform will not work.
Lines indented below a section describe the specific problem. The ✗ and ! lines under a section, such as the license message above, are the actionable items. Read the message text and follow it. Most messages include the exact command to run.
The last line counts the categories with issues, not individual problems. One category can hold several problems, so fix them one at a time and rerun the command after each fix.
A workflow for fixing problems
Treat flutter doctor as a loop. It is cheap to run, so rerun it after every change.
Get more detail with -v
The summary is deliberately short. Add -v (verbose) to see the paths and versions that Flutter detected:
flutter doctor -vVerbose output shows the SDK path, the Dart version, the Android SDK location, the Java binary in use, and the Xcode build number. This is the output to paste into a bug report or a forum question. It is also the quickest way to find out that Flutter is using a different Java or Android SDK than the one you intended.
Fix one platform at a time
Work through the sections that belong to the platforms you target. The fixes below are the ones that come up most often.
Android licenses. The Android SDK requires you to accept its licenses before Flutter can build. Run:
flutter doctor --android-licensesThe command asks you to review and accept each license. It needs the Android command-line tools, so if it complains that it cannot find sdkmanager, install "Android SDK Command-line Tools (latest)" from the SDK Manager in Android Studio first.
Android SDK not found. If you installed the SDK in a non-default place, tell Flutter where it is:
flutter config --android-sdk "/path/to/Android/sdk"Xcode command-line tools (macOS). If Xcode is installed but not selected, point the system at it and run its first-launch setup:
sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer
sudo xcodebuild -runFirstLaunchIf CocoaPods is reported missing, install it as the message suggests. Xcode also needs its license accepted, and sudo xcodebuild -license handles that.
Chrome not found. Flutter looks for Chrome in standard locations. If your browser lives elsewhere, set the CHROME_EXECUTABLE environment variable to the full path of the executable. If you will not develop for the web, you can ignore this line.
Windows desktop. The Visual Studio section requires the "Desktop development with C++" workload. This is a separate item in the Visual Studio installer. Installing Visual Studio Code does not satisfy it.
Linux desktop. The Linux toolchain section lists missing packages, typically clang, CMake, Ninja, pkg-config, and the GTK development headers. Install them with your package manager.
Ignore what you do not need
A warning for a platform you will never target is not a defect in your setup. Missing Xcode on a Linux machine never shows up, but a missing Chrome or an unaccepted Android license can. If you build only for Android, a [!] on Chrome does not stop you. The goal is a green check for each platform you intend to ship to, not a fully green screen.
Common gotchas
- Stale results after installing something. If you install a tool and
flutter doctorstill reports it missing, open a new terminal. Your current shell may hold an oldPATH. - Several Flutter SDKs. If you have more than one copy of the SDK,
flutter doctor -vshows which one the shell uses. Runwhich flutteron macOS or Linux, orwhere flutteron Windows, to confirm. - Java mismatch. Android builds need a compatible JDK. The verbose output shows which Java Flutter found. Android Studio bundles one, and Flutter normally uses it.
- Network resources failures. This section fails behind a proxy or firewall that blocks the hosts Flutter downloads from. Fix your proxy settings or ask your network administrator. Reinstalling Flutter will not help.
- Plugin warnings. If an editor shows up with a missing Flutter or Dart plugin, the editor itself is fine. Install the plugin from the editor's extension manager.
Exercise
Exercise
You run flutter doctor and see [✓] Flutter, [!] Android toolchain with the message "Android license status unknown", and [!] Connected device with "No devices available". You want to build for Android. Which problem do you fix first, which command do you run, and what do you do about the device line?
Show answer
Fix the Android toolchain first. Run flutter doctor --android-licenses and accept the licenses. This needs the Android command-line tools, so if the command cannot find sdkmanager, install them from Android Studio's SDK Manager first. The "No devices available" line does not mean the setup is broken. It means no emulator is running and no phone is connected. Start an emulator or plug in a device, then rerun flutter doctor (or flutter devices) to confirm.
Exercise
A teammate says flutter doctor shows a [✗] for Visual Studio, even though they installed Visual Studio Code. What is the cause, and how do they fix it?
Show answer
Visual Studio Code is an editor and does not provide the C++ build tools. Flutter's Windows desktop support needs the full Visual Studio with the "Desktop development with C++" workload. They should install it with the Visual Studio installer, then rerun flutter doctor. If they do not plan to build for Windows desktop, they can ignore the line.