Reputation: 495
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
Reputation: 1
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
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
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
Reputation: 21
I agree mostly on what others have said, this worked for me:
(Windows+Android Studio)
sdk.dir=C\:\\\\Users\\username\\AppData\\Local\\Android\\Sdk
flutter.sdk=C\:\\\\src\\flutter
*"username" being your own user
Android Studio will then restart and build.gradle
file error should be gone.
Upvotes: 2
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
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
Reputation: 399
In local.properties of your android project, enter your flutter location like that:
flutter.sdk=C:\\src\\flutter
Upvotes: 0
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
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
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
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
Upvotes: 6
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
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
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