First Flutter App error: cannot resolve symbol “Properties”

前端 未结 13 2324
南旧
南旧 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 04:59

    This issue is due to the not pointing to correct Android API Platform

    Solution :

    In the Android Studio File > Project Structure

    1. Now a window pops up
    2. Within that select Project Settings/Project
    3. Make sure Project SDK is set to latest platform as mentioned in the pic below

    1. Next select Project Settings/Modules sub tab
    2. There select the lastest Android SDK you select as earlier

    1. Finally replace the GradleException() with FileNotFoundException() as mentioned below

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

    It's working for me:

    1. File > Project Structure (Command + ;) > Under Project Settings/Project > Set Project SDK to Android API 29 Platform
    2. There should be a notification stating there is an invalid item in the dependencies list under Project Structure/Problems. If there is, go to Project Structure > Under Project Settings/Modules > select app_name_android > Dependencies tab > choose the latest "Android API 29 Platform" in the Module SDK box.
    3. Update GradleException() to FileNotFoundException() under android/app/build_gradle since it's not supported in the Java version of Android API 29 Solution found
    0 讨论(0)
  • 2020-12-29 05:03

    Need to include google maven repository to your project level build.gradle file.

    buildscript {
        repositories {
            google()
            jcenter()
            maven {                                    //add this section 
                url "https://maven.google.com"           
            }
        }
    
        dependencies {
            classpath 'com.android.tools.build:gradle:3.5.0'
        }
    }
    
    0 讨论(0)
  • 2020-12-29 05:04

    I had the same issue in Android Studio. It looks like a bug with the Flutter Plugin so it's pretty likely it's a problem in Intellij too. In Android Studio there is a link to "Open for Editing in Android Studio" (top right). When I click that I see there are no longer any issues highlighted. I would check for a similar link in IntelliJ. Here is the Flutter issue where I learned of this: https://github.com/flutter/flutter/issues/37391.

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

    In yours "project\android\build.gradle" Just change:

    classpath 'com.google.gms:google-services:4.3.2'
    

    to:

    classpath 'com.google.gms:google-services:4.0.2'
    
    0 讨论(0)
  • 2020-12-29 05:16

    I tried all other suggestions, and they did not help. Then I have removed "new" in front of GradleException, and it solved the problem:

    throw GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
    

    It worked perfectly fine with the "new" word for a long time. I don't know what have caused this change.

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