Dart SDK is not configured

0 votes

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:

  1. Installed Flutter

  2. Installed Android Studio, along with Flutter plugin including Dart plugin

  3. 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.

Mar 6, 2023 in Android by Tejashwini
• 780 points
19,784 views

1 answer to this question.

0 votes

The error message "Dart SDK is not configured" usually occurs when the Dart SDK path is not set in Android Studio. Here are the steps you can follow to configure the Dart SDK in Android Studio:

  1. Open Android Studio and go to Preferences (on Mac) or Settings (on Windows).

  2. In the search bar, type "Dart SDK" to find the Dart SDK path setting.

  3. Click on "Add..." and navigate to the Flutter SDK directory. Select the "bin/cache/dart-sdk" folder inside the Flutter SDK directory.

  4. Click "Apply" to save the settings.

  5. Restart Android Studio and try running the example project again.

As for the Gradle error, it seems to be related to a problem with the build configuration in the example project. You may want to try running the project on the command line using flutter run to see if that works. If you still encounter the Gradle error, you may need to review the Gradle project setup in the android/ folder and make sure all dependencies are correctly configured.

answered Mar 9, 2023 by pooja

Related Questions In Android

0 votes
1 answer

Why is applicationWillTerminate not being called on the first launch of my app?

The applicationWillTerminate method is called by the ...READ MORE

answered Mar 18, 2023 in Android by vishalini
2,033 views
0 votes
0 answers

What is the difference between C# and .NET?

May I know what is the difference ...READ MORE

Sep 20, 2022 in Android by Edureka
• 13,620 points
394 views
0 votes
0 answers

Android Studio: Where is the Compiler Error Output Window?

When I "Run" my project in Android ...READ MORE

Sep 21, 2022 in Android by Edureka
• 13,620 points
486 views
0 votes
0 answers

How to make grid view scroll horizontally not vertically in android?

I use a flexible Grid View. means ...READ MORE

Sep 21, 2022 in Android by Edureka
• 13,620 points
551 views
0 votes
1 answer

flutter doctor --android-licenses gives a java error

This error usually occurs because the Java ...READ MORE

answered Mar 24, 2023 in Flutter by venky
4,474 views
0 votes
1 answer

Flutter command not found

This error message usually appears when the ...READ MORE

answered Mar 29, 2023 in Flutter by vishalini
18,242 views
0 votes
1 answer

"Android Gradle plugin requires Java 11 to run. You are currently using Java 1.8"

Based on the error message, the Android ...READ MORE

answered Apr 14, 2023 in Flutter by pooja
9,356 views
0 votes
1 answer

What is the future of flutter?

Hi@MD, Flutter is a rather new cross-platform framework ...READ MORE

answered Jul 17, 2020 in Others by akhtar
• 38,260 points
1,179 views
0 votes
1 answer

What is Flutter?

Flutter is a free and open-source mobile ...READ MORE

answered Mar 1, 2023 in Android by vishalini
799 views
0 votes
1 answer

How do you detect the host platform from Dart code?

You can detect the host platform from ...READ MORE

answered Mar 1, 2023 in Android by vishalini
1,395 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP