APP
APP

Reputation: 495

ERROR: Flutter SDK not found. Define location with flutter.sdk in the local.properties file

ERROR: Flutter SDK not found. Define location with flutter.sdk in the local.properties file.

I have imported Flutter sample application mahtab-ali-fitness_app_ui which gives me error, anyone knows about it?

Upvotes: 22

Views: 105398

Answers (15)

just comment it

//throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")

that'll do the trick.

Upvotes: 0

user22041725
user22041725

Reputation:

Go To!

Android > local.properties

Copy your flutter sdk path from your directory and replace here.

or,

Android > app> build.gradle

replace error line with this line

throw new FileNotFoundException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.") }

Done!

Upvotes: 0

مصطفى
مصطفى

Reputation: 995

to to android folder -> local.properties file add this line

flutter.sdk=C\:\\src\\flutter

Upvotes: 2

Sunny
Sunny

Reputation: 3265

You need to go inside the android folder. And then click on the local.properties file.

It contains something like this:

sdk.dir=/Users/sunnysaini/Library/Android/sdk
flutter.sdk=/Users/sunnysaini/development/flutter
flutter.buildMode=debug
flutter.versionName=1.0.0
flutter.versionCode=1

And the issue is with flutter.sdk path. You need to replace this path with your flutter sdk path.

Upvotes: 36

yitowee
yitowee

Reputation: 21

I agree mostly on what others have said, this worked for me:

(Windows+Android Studio)

  1. Change these lines in the local.properties file from the Project view to update the paths of your sdks(my_app/android/app/local.properties)
sdk.dir=C\:\\\\Users\\username\\AppData\\Local\\Android\\Sdk

flutter.sdk=C\:\\\\src\\flutter

*"username" being your own user

  1. In Android Studio restart your IDE using the "File>Invalidate Caches/Restart..." option and press "Invalidate and Restart" from the appearing window.

Android Studio will then restart and build.gradle file error should be gone.

Upvotes: 2

Akito
Akito

Reputation: 41

I changed app/build.gradle as below and solved it.

Before change

def keystorePropertiesFile = rootProject.file('app/key.properties')

After change

def keystorePropertiesFile = rootProject.file('key.properties')

Upvotes: 0

saad
saad

Reputation: 21

If you have the flutter SDK installed.

in the command line, run:

flutter doctor -v

The first line will show the install path.

if you don't have it installed go to the documentation that you can find it here Flutter documentation

Upvotes: 1

Walied Abdulaziem
Walied Abdulaziem

Reputation: 399

In local.properties of your android project, enter your flutter location like that:

flutter.sdk=C:\\src\\flutter

Upvotes: 0

Eldhose
Eldhose

Reputation: 756

For me, the error disappeared when opened the flutter project and did a

flutter pub get

The file created automatically and when opened in android studio everything was fine

Upvotes: 3

mzsdev
mzsdev

Reputation: 320

Android > app > build.gradle: it might work if you replace the code written there with this one

throw new FileNotFoundException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")

Upvotes: 8

Alexey Nazarov
Alexey Nazarov

Reputation: 2347

I had the right path in local.properties and still there was the same problem.

export ANDROID_HOME=/home/user/Android/Sdk

solved my problem

Upvotes: 0

Khaled Boussoffara
Khaled Boussoffara

Reputation: 1771

In your local.properties file located in android folder of your app, add the path to your downloaded flutter folder and make sure to write the path correctly

enter image description here

Upvotes: 6

Himanshu Sharma
Himanshu Sharma

Reputation: 1094

Check your local.properties file, whether the path to flutter.sdk is valid or not. If it is valid, then try to upgrade the flutter plugin and restart your IDE. This fixed the issue for me.

Upvotes: 1

Sonu Sourav
Sonu Sourav

Reputation: 3514

Add the following line in the local.properties file.

flutter.sdk=C\:\\flutter_sdk\\flutter_windows_1.17.5-stable\\flutter

Make sure to add two backward slashes instead of one between each folder name and a backward slash after C also.

Upvotes: 0

Shanto Barua
Shanto Barua

Reputation: 81

If you installed flutter on C:/ drive. Path will be something like this

flutter.sdk=C\:\\flutter

Don't forget to add \ after the C.

Upvotes: 9

Related Questions