First Flutter App error: cannot resolve symbol “Properties”

前端 未结 13 2347
南旧
南旧 2020-12-29 04:46

I followed the steps in the Flutter document and tried to build my first Flutter app in Intellij IDEA. And when I try to run it,there was an error about my JAVA_HOME variabl

相关标签:
13条回答
  • 2020-12-29 05:16

    I've just had this issue and in my case was due to an invalid SDK configuration. I've solved by going to:

    Project structure > Project Settings > Modules > Module SDK

    and switching from <no project SDk>

    to Android api 29 platform

    0 讨论(0)
  • 2020-12-29 05:17

    I have same problem. I get this error because I edit android module without open it first using AS in another tab (Tools -> Flutter -> Open Android module..). Then I have a solution, just restart and kill the chache in your Android Studio (File -> Invalidate Chache / Restart).

    It fixed for me, I hope you too

    https://github.com/flutter/flutter/issues/29608#issuecomment-528243662

    0 讨论(0)
  • 2020-12-29 05:18

    Go to File -> Project Structure -> Modules -> Select your project -> apply your API

    0 讨论(0)
  • 2020-12-29 05:19

    Yes, i follow this https://github.com/flutter/flutter/issues/37391#issuecomment-544823712 and i change GraddleException to FileNotFoundException in android/app/build.gradle. Otherwise upgrade kotlin version in android/build.gradle to 1.3.50. At least, upgrade gradle distributionUrl to version 5.4.1

    0 讨论(0)
  • 2020-12-29 05:22

    Update: Oct. 15, 2020.

    I am running Flutter Version 1.12.13+hotfix9 in Android Studio Version 4.1 (re-installed today) with runtime version 1.8.0_242-release-1644.... on Windows 10, amd64.

    I repaired both the project level and app level gradle build files by removing the word 'new' before 'Properties' and 'GradleException' and in both files the Studio error messages were removed.

    0 讨论(0)
  • 2020-12-29 05:24

    For me just deleting new before Properties and GradleException it have solved it.

    • Flutter version 1.21.0-10.0.pre.55 | Master Channel |
    • Dart version 2.10.0 (build 2.10.0-11.0.dev)
    • Android Studio 4.0.1
    

    here is first lines in build.gradle 'contains changes'

    def localProperties = Properties()
    def localPropertiesFile = rootProject.file('local.properties')
    if (localPropertiesFile.exists()) {
        localPropertiesFile.withReader('UTF-8') { reader ->
            localProperties.load(reader)
        }
    }
    
    def flutterRoot = localProperties.getProperty('flutter.sdk')
    if (flutterRoot == null) {
        throw GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
    }
    

    . . . . . . . .

    0 讨论(0)
提交回复
热议问题