Where is Dart's SDK located within /flutter folder?
Android StudioDartFlutterAndroid Studio Problem Overview
Software
MacOS Sierra 10.12.6
Android Studio 3.1.2
Flutter 0.3.2 • channel beta
Tools • Dart 2.0.0-dev.48.0.flutter-fe606f890b
Flutter doctor (no problems found)
Problem
Dart's SDK is supposed to be bundled when Flutter is downloaded according to the documentation:
> "The Dart SDK is bundled with Flutter; it is not necessary to install Dart separately"
However, I opened an existing Flutter project with Android Studio and it suggested me to either "Download Dart SDK" or "Open Dart settings":
Apparently, I need to "Open Dart settings" and tell Android Studio where to find the Dart' SDK. However, it can't find it within the flutter/
directory.
Android Studio Solutions
Solution 1 - Android Studio
The Dart SDK lives inside the bin/cache/dart-sdk
folder of the Flutter SDK. It will be downloaded the first time you run the flutter
command, so may not exist if you've not yet run flutter
.
Solution 2 - Android Studio
The Dart's SDK is located at /flutter/bin/cache/dart-sdk
However, If Android Studio's flutter plugin is installed, the plugin needs to be told where flutter's SDK is located. Android Studio should be able to locate Dart's SDK afterwards:
Solution 3 - Android Studio
I have downloaded flutter sdk via homebrew
For Mac OS: 10.14.5
Android Studio version : Arctic Fox 2020.3.1
Flutter sdk location is /usr/local/Caskroom/flutter/2.5.0/flutter
Dart location: /usr/local/Caskroom/flutter/2.5.0/flutter/bin/cache/dart-sdk
Solution 4 - Android Studio
After installing flutter however you choose.
-
run the following command > flutter sdk-path
-
In Android-Studio select File->Setting->Languages & Frameworks->Flutter (assuming you have installed teh flutter plugin)
-
Populate the "Flutter SDK path:" with the result from (1).
-
Click apply. The Dart SDK should automatically get populated.
For my installation the values are:
> Flutter SDK path: /home/andrew/snap/flutter/common/flutter
> Dart SDK path: /home/andrew/snap/flutter/common/flutter/bin/cache/dart-sdk
Solution 5 - Android Studio
If you installed Dart on Windows via Chocolatey, you will find it on C:\tools\dart-sdk
Solution 6 - Android Studio
Run brew info flutter
Then you get the path: e.g.
/opt/homebrew/Caskroom/flutter/2.5.3
And there the bin/cache
has the dartk-sdk:
/opt/homebrew/Caskroom/flutter/2.5.3/flutter/bin/cache/dart-sdk
Solution 7 - Android Studio
I have faced this issue,
-
Go to the folder where you have downloaded flutter and then delete the flutter folder.
-
Go to your download folder and where you have downloaded the flutter the first time.
-
Extract this file again where you have deleted the flutter...
This is working for me.
Solution 8 - Android Studio
Everyone that is still searching for the correct answer should checkout this answer https://stackoverflow.com/a/63409260/9823820.
If you have the flutter SDK installed.
Run:
flutter doctor -v
The first line will show the install path.
Credits go to @Lee Higgins
Solution 9 - Android Studio
Sometimes it is the build
directory that he cannot create, suddenly devtools crashes, you can simply recreate it in $HOME/.pub-cache/hosted/pub.dartlang.org/devtools-your-version
, then give it the right rights with for example sudo chown -R $USER:$USER $HOME/.pub-cache/hosted/pub.dartlang.org/devtools-your-version/build
after re-creating the build directory