Reputation: 29
same question is also asked here but doesn't solve the problem that's why it is asked here again. Could not set unknown property 'localProperties' for project ':app' of type org.gradle.api.Project
i'm running flutter build appbundle command and getting below error:
FAILURE: Build failed with an exception.
Where: Build file 'D:\LiveApps\himachal_quiz\android\app\build.gradle' line: 7
What went wrong: A problem occurred evaluating project ':app'.
Could not get unknown property 'localProperties' for project ':app' of type org.gradle.api.Project.
- Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
Code in app/build.gradle:
def keystoreProperties = new Properties()
def keystorePropertiesFile = rootProject.file('key.properties')
if (keystorePropertiesFile.exists()) {
keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
}
def flutterRoot = localProperties.getProperty('flutter.sdk')
if (flutterRoot == null) {
throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
}
it says error in line no. 7 see the images for line number 7 for the above code.
Upvotes: 0
Views: 3705
Reputation: 53
Check if your path to flutter.sdk in local.properties matches with your sdk path in Preferences > Languages & Frameworks > Flutter. Also check if your path to flutter sdk is correct.
local.properties file is available in android folder.
Refer images below:
flutter sdk path in Preferences
flutter sdk path in local.properties
Upvotes: 1