First Flutter App error: cannot resolve symbol “Properties”


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 variable. And an error about cannot resolve symbol "Properties" in the build.gradle file. I really don't know what to do.

This is my error information displayed in the Console window.

Launching lib\main.dart on Android SDK built for x86 in debug mode...
Initializing gradle...
Finished with error: ProcessException: Process 
"F:\untitled\android\gradlew.bat" exited abnormally:

ERROR: JAVA_HOME is set to an invalid directory: F:\Google download\jdk- 

Please set the JAVA_HOME variable in your environment to match the
location of your Java installation.
  Command: F:\untitled\android\gradlew.bat -v

Actually there is nothing wrong with my JAVA_HOME variable, I set it to the proper directory: C:\Program Files (x86)\Java\jdk1.8.0_131.

And I run the command it shows above "F:\untitled\android\gradlew.bat -v", it seemed to update the gradle version, but the error didn't resolved.

And this is the code in build.gradle file.

def localProperties = new Properties() 
//there will be a highlight on Properties indicates that 'cannot resolve symbol "Properties" '

def localPropertiesFile = rootProject.file('')
if (localPropertiesFile.exists()) {
    localPropertiesFile.withReader('UTF-8') { reader ->

def flutterRoot = localProperties.getProperty('flutter.sdk')
if (flutterRoot == null) {
    throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the file.")
//the same as the Properties on GradleException

def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
if (flutterVersionCode == null) {
    flutterVersionCode = '1'

def flutterVersionName = localProperties.getProperty('flutter.versionName')
if (flutterVersionName == null) {
    flutterVersionName = '1.0'

apply plugin: ''
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"

android {
    compileSdkVersion 28

    lintOptions {
        disable 'InvalidPackage'

    defaultConfig {
        // TODO: Specify your own unique Application ID (
        applicationId "com.example.untitled"
        minSdkVersion 16
        targetSdkVersion 28
        versionCode flutterVersionCode.toInteger()
        versionName flutterVersionName
        testInstrumentationRunner ""

    buildTypes {
        release {
            // TODO: Add your own signing config for the release build.
            // Signing with the debug keys for now, so `flutter run --release` works.
            signingConfig signingConfigs.debug

flutter {
    source '../..'

dependencies {
    testImplementation 'junit:junit:4.12'
    androidTestImplementation ''
    androidTestImplementation ''


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 file.")

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


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


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


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


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

buildscript {
    repositories {
        maven {                                    //add this section 
            url ""           

    dependencies {
        classpath ''


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


Yes, i follow this 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


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


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:


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

classpath ''


classpath ''


According to flutter documentation

Opening the root directory of a Flutter project doesn’t expose all the Android files to the IDE. Flutter apps contain a subdirectory named android. If you open this subdirectory as its own separate project in Android Studio, the IDE will be able to fully support editing and refactoring all Android files (like Gradle scripts).