简体   繁体   English

为什么 build.gradle 文件显示“属性”类的错误?

[英]Why does build.gradle file showing error for "Properties" class?

I am new to flutter developing.我是颤振开发的新手。 Recently I was learning to connect firebase with flutter but facing some problem.最近我正在学习将 firebase 与 flutter 连接,但遇到了一些问题。 Here in the app gradle file, this "Properties" class is not found.在应用程序 gradle 文件中,找不到这个“属性”类。 But this was even given in the file I haven't touched anything.但这甚至在我没有触及任何东西的文件中给出。 Cannot find any solution.找不到任何解决方案。 Hope I could get ea solution here!希望我能在这里得到一个解决方案!

def localProperties = new Properties()

if (flutterRoot == null) {
    throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
}

Faced a similar issue and it turned out to be a missing/unconfigured sdk:遇到了类似的问题,结果是缺少/未配置的 sdk:

You might be missing a jdk in your project settings:您可能在项目设置中缺少 jdk:

Do the following:请执行下列操作:

In Android Studio: Go to File > Open Project Structure .Then in the SDk section if your sdk looks like this:在 Android Studio 中:转到File > Open Project Structure 。然后在 SDk 部分,如果您的 sdk 如下所示:

缺少 SDK

Select the drop down icon and if you installed your jdk and sdk properly in the initial stages of setting up your android studio, you will find options for your sdk or jdk.选择下拉图标,如果您在设置 android studio 的初始阶段正确安装了 jdk 和 sdk,您将找到适用于您的 sdk 或 jdk 的选项。 If you are not sure which option to select, there is a download option in the list of options in the dropdown.如果您不确定要选择哪个选项,下拉选项列表中有一个下载选项。

SDK/JDK 选项

If this does not solve your issue:如果这不能解决您的问题:

The second solution is to remove the "new" keyword before properties.第二种解决方案是删除属性前的“new”关键字。

***NB:This could break your app.***

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM