Troubleshooting installation
This page describes some common installation issues that new Flutter users have encountered and offers suggestions on how to resolve them.
If you are still experiencing problems after using this page, consider reaching out to any of the resources listed under community support channels . To add a topic to this page or make a correction, you can file an issue or submit a pull request on GitHub.
Get the Flutter SDK
#
Unable to find the
flutter
command
#
What does this issue look like?
When you try to run the
flutter
command, the console fails to find it. The error usually looks as follows:
'flutter' is not recognized as an internal or external command operable program or batch file
Error messages on macOS and Linux could look slightly different from the one on Windows.
Explanation and suggestions
Did you add Flutter to the
PATH
environment variable for your platform? On Windows, follow these
instructions for adding a command to your path
.
If you've already
set up VS Code
for Flutter development, you can use the Flutter extension's
Locate SDK
prompt to identify the location of your
flutter
folder.
See also: Configuring PATH and Environment Variables - Dart Code
Flutter in special folders
#What does this issue look like?
Running your Flutter project produces an error like the following:
The Flutter SDK is installed in a protected folder and may not function correctly.
Please move the SDK to a location that is user-writable without Administration permissions and restart.
Explanation and suggestions
On Windows, this usually happens when Flutter is installed in a directory like
C:\Program Files\
that requires elevated privileges. Try relocating Flutter to a different folder, such as
C:\src\flutter
.
Android setup
#Having multiple versions of Java installed
#What does this issue look like?
The command
flutter doctor --android-licenses
fails. Running
flutter doctor --verbose
gives an error message like the following:
java.lang.UnsupportedClassVersionError: com/android/prefs/AndroidLocationsProvider
has been compiled by a more recent version of the Java Runtime (class file version 55.0),
this version of the Java Runtime only recognizes class file versions up to 52.0
Explanation and suggestions
The error occurs when an older version of the Java Development Kit (JDK) is installed on your computer.
If you don't need multiple versions of Java, uninstall existing JDKs from your computer. Flutter automatically uses the JDK included in Android Studio.
If you do need another version of Java, try the workaround described in this GitHub issue until a long-term solution is implemented. For more information, check out the Android Java Gradle migration guide or flutter doctor --android-licenses not working due to java.lang.UnsupportedClassVersionError - Stack Overflow .
cmdline-tools
component is missing
#
What does this issue look like?
The
flutter doctor
command complains that the
cmdline-tools
are missing from the Android toolchain. For example:
[!] Android toolchain - develop for Android devices (Android SDK version 33.0.2)
• Android SDK at C:\Users\My PC\AppData\Local\Android\sdk
X cmdline-tools component is missing
Explanation and suggestions
The easiest way to get the cmdline-tools is through the SDK Manager in Android Studio. To do this, use the following instructions:
- Open the SDK Manager from Android Studio by selecting Tools > SDK Manager from the menu bar.
- Select the latest Android SDK (or a specific version that your app requires), Android SDK Command-line Tools, and Android SDK Build-Tools.
- Click Apply to install the selected artifacts.
If you're not using Android Studio, you can download the tools using the sdkmanager command-line tool.
macOS setup
#SocketException: Send failed, OS Error: No route to host, errno = 65
#What does this issue look like?
On macOS, the
flutter run
command produces an error like:
$ flutter run
Launching lib/main.dart in debug mode...
Installing and launching...
Oops; flutter has exited unexpectedly: "SocketException: Send failed (OS Error: No route to host, errno = 65), address = 0.0.0.0, port = 5353".
Explanation and suggestions
This issue is related to macOS permissions.
To fix this:
-
Upgrade your Flutter SDK to the latest version.
-
Open System Settings > Privacy & Security > Local Network . Toggle on the permission for all the code editors and terminals you use to launch Flutter apps. You might need to restart your code editor, terminal, and physical device.
Other problems
#Exit code 69
#What does this issue look like?
Running a
flutter
command produces an "exit code: 69" error, as shown in the following example:
Running "flutter pub get" in flutter_tools...
Resolving dependencies in .../flutter/packages/flutter_tools... (28.0s)
Got TLS error trying to find package test at https://pub.dev/.
pub get failed
command:
".../flutter/bin/cache/dart-sdk/bin/
dart __deprecated_pub --color --directory
.../flutter/packages/flutter_tools get --example"