[英]Could not get unknown property 'localProperties' for project ':app' of type org.gradle.api.Project
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
无法为类型为 org.gradle.api.Project 的项目“:app”设置未知属性“localProperties”
i'm running flutter build appbundle command and getting below error:我正在运行flutter build appbundle命令并出现以下错误:
FAILURE: Build failed with an exception.
失败:构建失败,出现异常。
Where: Build file 'D:\LiveApps\himachal_quiz\android\app\build.gradle' line: 7
其中:构建文件 'D:\LiveApps\himachal_quiz\android\app\build.gradle' 行:7
What went wrong: A problem occurred evaluating project ':app'.
出了什么问题:评估项目“:app”时出现问题。
Could not get unknown property 'localProperties' for project ':app' of type org.gradle.api.Project.
无法为类型为 org.gradle.api.Project 的项目“:app”获取未知属性“localProperties”。
- Try:
尝试:
Run with --stacktrace option to get the stack trace.
使用 --stacktrace 选项运行以获取堆栈跟踪。 Run with --info or --debug option to get more log output. Run with --scan to get full insights.
使用 --info 或 --debug 选项运行以获取更多日志 output。使用 --scan 运行以获取完整的见解。
Code in app/build.gradle : 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.它在第 1 行显示错误。 7 see the images for line number 7 for the above code.
7 查看上述代码第 7 行的图像。
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 中 flutter.sdk 的路径是否与 Preferences > Languages & Frameworks > Flutter 中的 sdk 路径匹配。还要检查 flutter sdk 的路径是否正确。
local.properties file is available in android folder. local.properties 文件位于 android 文件夹中。
Refer images below:参考下图:
flutter sdk path in Preferences flutter sdk 首选项中的路径
flutter sdk path in local.properties flutter sdk local.properties 中的路径
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.