0

I installed all the flutter requirements including the flutter and dart plugins for android studio successfully and nothing is missing. I created a new flutter project without selecting Kotlin support, yet after I created the project I got this code with problem related to kotlin

Kotlin version that is used for building with Gradle (1.2.71) differs from the one bundled into the IDE plugin (1.3.50)

And this is the build.gradle file code:

buildscript {
    ext.kotlin_version = '1.2.71'
    repositories {
        google()
        jcenter()
    }

    dependencies {
        classpath 'com.android.tools.build:gradle:3.5.0'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
    }
}

allprojects {
    repositories {
        google()
        jcenter()
    }
}

rootProject.buildDir = '../build'
subprojects {
    project.buildDir = "${rootProject.buildDir}/${project.name}"
}
subprojects {
    project.evaluationDependsOn(':app')
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

The other problem is in this diretory : android/app/src/build.gradle. I get an error related to the line of code :

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

When I move the mouse on the function name I see this :

Cannot resolve symbol 'GradleException'

This is the gradle.properties content:

org.gradle.jvmargs=-Xmx1536M

android.useAndroidX=true
android.enableJetifier=true

Test Project
  • 41
  • 2
  • 3

1 Answers1

0

Update kotlin in the build.gradle to the following:

ext.kotlin_version = '1.3.50'

or check the answer here


Inside the local.properties file add the path to the flutter sdk location:

flutter.sdk=/path/to/your/flutter/sdk
flutter.buildMode=debug
Peter Haddad
  • 78,874
  • 25
  • 140
  • 134
  • after I edited local.properties it seems that the line 'flutter.build= debug' is 'not used' like what appeared to me. I already have this in the local.properties: ` sdk.dir=C:\\Users\\Fateh\\AppData\\Local\\Android\\sdk flutter.sdk=C:\\flutter sdk\\flutter ` do I need to change something ? – Test Project Sep 14 '19 at 14:30
  • is the location to the fluttersdk correct? If it is you might need to change `flutter sdk` this folder to this `flutter-sdk` and then change it in your local.properties file – Peter Haddad Sep 14 '19 at 14:31
  • @TestProject have you tried changing the name without space? – Peter Haddad Sep 15 '19 at 04:52