Dart SDK is not configured
Solution 1
I had the same problem after importing a flutter project from git. These are the steps to solve the problem.
- File->Settings->Language & Framework->Flutter
- Choose flutter SDK path: the first time we install flutter, we choose the location where the flutter should be installed. Choose this location.
- Click OK and the android studio will refresh. Carry on if the problem is solved.
- If you are still stuck with the error.
- Goto this link and install Dart.
- Goto the same place in settings, ..Language & Framework->Dart and chose the SDK location.
This solved the issues for me.
Solution 2
It usually happens with projects that were created in other machines. To fix this on Android Studio 3.1.3:
- File-> Settings (ctrl+alt+s)
- Languages and Frameworks -> Dart
- Check "Enable Dart support for the project..."
- In "Dart SDK path" click in "..." and navigate to flutter SDK directory. Under that directory you'll find "bin/cache/dart-sdk". This is the dart sdk path you should use.
- Click "Apply"
- Close the project and open it again (sometimes you need this step, sometimes doesn't)
Edit 2019-05-28 - I don't know how long this option is enabled but I have noticed that in Android Studio 3.4 it's easier to Enable Dart Support in projects that were developed in other machines.
- File -> Sync Project With Gradle Files
- After it builds, click in "Enable dart support" in the top of editor panel.
Solution 3
I had the same Dart SDK issue and I used this for my solution. To remedy the issue without having to use the terminal to test my programs each time the steps I followed are as follows.
- Find
flutter
SDK path. I did so by typing inecho $PATH
and finding the path with /flutter/bin. - Assuming your path is something like
.../flutter/bin
just add on/cache/dart-sdk/bin
making it.../flutter/bin/cache/dart-sdk/bin
. - This
.../flutter/bin/cache/dart-sdk/bin
is the location of your Dart SDK. Assuming you say the same Dart SDK is not configured error accompanied by something where you can configure your Dart SDK. You click the configure option and set.../flutter/bin/cache/dart-sdk
as your SDK. That should fix your problem. If not head over to the next step. - Open your Android Studio preferences(Command + ',') and go to
Languages and Frameworks>Dart
. - Under the Dart menu, you should be able to enter your Dart SDK path.
I went through these steps using IntelliJ IDEA so they should be pretty much the same. If that didn't work, sometimes making a dummy Dart project can get things working again. That fixed a similar issue for me.
Solution 4
In my machine, flutter was installed in
C:\src\flutter
I set dart sdk path as
C:\src\flutter\bin\cache\dart-sdk
This solved my problem
Solution 5
It may help to use the doctor with -v
flutter doctor -v
for me the result was as
...
Flutter version 2.0.5 at /usr/local/Caskroom/flutter/2.0.5/flutter
...
Then the dart path can be set as
/usr/local/Caskroom/flutter/2.0.5/flutter/bin/cache/dart-sdk
Related videos on Youtube
Katelyn
Updated on December 26, 2021Comments
-
Katelyn over 2 years
I installed Flutter and set up Android Studio. Then I cloned an example of flutter on GitHub (https://github.com/flutter/flutter) and launched it in Android Studio, but it warns me "Dart SDK is not configured", this happened to my co-worker as well. But if I create a new project in Android Studio, no problem at all.
What I have done:
-
Installed Flutter
-
Installed Android Studio, along with Flutter plugin including Dart plugin
-
Flutter run in command line works fine, all five tests passed. (See below)
[✓] Flutter (on Mac OS X 10.13.3 17D47, locale en-US, channel dev) • Flutter version 0.0.22 at /Users/katelyn/flutter • Framework revision 3001b3307d (7 days ago), 2018-01-30 11:37:15 -0800 • Engine revision 8f2d72b183 • Tools Dart version 2.0.0-dev.16.0 • Engine Dart version 2.0.0-edge.7af4db0ea091dddca6b2da851e6dda8d7f9467e8
[✓] Android toolchain - develop for Android devices (Android SDK 27.0.3) • Android SDK at /Users/katelyn/Library/Android/sdk • Android NDK location not configured (optional; useful for native profiling support) • Platform android-27, build-tools 27.0.3 • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-915-b08)
[✓] iOS toolchain - develop for iOS devices (Xcode 9.2) • Xcode at /Applications/Xcode.app/Contents/Developer • Xcode 9.2, Build version 9C40b • ios-deploy 1.9.2 • CocoaPods version 1.4.0
[✓] Android Studio (version 3.0) • Android Studio at /Applications/Android Studio.app/Contents • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-915-b08)
[✓] Connected devices • Android SDK built for x86 • emulator-5554 • android-x86 • Android 7.1.1 (API 25) (emulator)
Last week, I can run their example thru command line (in that dir),
flutter run
but now I it shows some errors with Gradle.
Launching lib/main.dart on Android SDK built for x86 in debug mode... Initializing gradle... 0.7s Resolving dependencies...
- Error running Gradle: Exit code 1 from: /Users/katelyn/AndroidStudioProjects/flutter/examples/flutter_gallery/android/gradlew app:properties:
FAILURE: Build failed with an exception.
-
Where: Build file '/Users/katelyn/AndroidStudioProjects/flutter/examples/flutter_gallery/android/app/build.gradle' line: 20
-
What went wrong: A problem occurred evaluating project ':app'. 3
-
Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
-
Get more help at https://help.gradle.org
BUILD FAILED in 0s
Please review your Gradle project setup in the android/ folder.
-
Krunal about 6 yearsYou can use Android Studio, open and run your flatter project. I just tested it successfuly in Android Studio
-
Krunal about 6 yearsDid you update anything in your
projectSource > android > gradle.build
-
Jerin over 2 yearsGo to project settings (
cmd + ,
in Mac &ctrl + ,
probably for Windows), under Languages & Frameworks, there should an option Dart, enable dart support if disabled and provide the path to where you have your dart installed -
PosmaJan over 2 yearsI get this error too, then I open 'project structure', click the problems, then I fix all the error. Worked for me. !image here
-
varotariya vajsi over 2 yearsGo to settings->languages & frameworks -> flutter -> in sdk section find "Flutter SDK path" and past your flutter sdk path here
-
-
Ricardo Gonçalves over 5 yearsJust to add a comment here, sometimes Android Studio find by itself the Dart SDK just clicking in "activate dart sdk" message.
-
Raymond Chenon about 5 years"bin/cache/dart-sdk" was the missing piece of information.
-
Avid Programmer over 4 yearsDart and chose the SDK location means - which path needs to selected
-
Sergio Pardo over 4 yearsI did everything to configure flutter and dart, the only thing missing was to close and reopen android studio to make it work
-
Sisir about 4 yearsBut what the java SDK path has to do here?
-
Purvik Rana about 4 yearsAll steps are perfect and still after that you're not able to solve then just open
pubspec.yaml
and clickPackages Get
. That will solve everything. -
s_khan92 about 4 yearsThere should be a small change: The path should be like this:
/cache/dart-sdk
without /bin in the end. -
Lutaaya Huzaifah Idris about 4 yearsThis worked better, I just simply specifies flutter SDK and it resolved the Dart issue.
-
Yako about 4 yearsand don't forget to select your project module before applying :)
-
Fellow7000 almost 4 yearsWorked for me on Mac after checkout from Github, thanks!
-
fucukur almost 4 yearsThere is dart-sdk in the flutter file.No need to reload. tnx
-
Codedreamer almost 4 yearsThis answer should be the one top. The answer is direct and people who migrated their project to a new android studio application are likely to have error like this.
-
BNetz about 3 yearsWhere to click "Packages Get" when I open the pubspec.yaml?
-
C. Sederqvist about 3 yearsThat may work, but it is certainly not "the best way". Quite far from it.
-
Pete Alvin almost 3 yearsYeah, "Sync Project With Gradle Files" no longer exists in File menu on Android Studio 4.2.1.
-
Daniel over 2 yearsI had Flutter installed and I tried to create a Dart Project in Intellij Idea, which resulted into an error. But after trying your solution regarding the path
.../flutter/bin/cache/dart-sdk/bin
it worked fine. -
Mike over 2 yearsAfter you choose the dart-sdk, make sure you check the module that your project is in as well or it won't be applied
-
Jaimin Modi about 2 yearsalso add how..?