skip to Main Content

I am new to Flutter/coding. I am trying to work on my first project. I am following an online tutorial to create a weather app.
I followed all the instructions but when I am running the app, nothing shows up on my emulator.
There is an error on the Debug Console as below:

enter image description here

I tried to google the error and found that I need to update the kotlin version in the buildscript in the build.gradle file. But in my build.gradle file there is no buildscript section. See below:
enter image description here

I again googled for solution and I thought what if I add the code in my build.gradle file so I added the code with latest kotlin version 1.9.22 yet the error is still there.

Where am I going wrong. Thanks for your help in advance.

I tried all solutions available in youtube and google. I have spent almost a day looking for it but no luck.

2

Answers


  1. Chosen as BEST ANSWER

    @Mehedi Hasan Updated everything as per your instruction yet the error isn't resolved.

    enter image description here

    enter image description here


  2. From my experience, Many times I have found that the latest Kotlin version is incompatible with the latest Flutter version.

    Please, try to downgrade the version to 1.9.20 or less. Also try stable versions like 1.8.22, …, 1.7.10, or others. Pick one that suits your project the best from here:
    https://kotlinlang.org/docs/releases.html#release-details

    and also from your screenshot, I saw that the section below is missing in your android/build.gradle file.

    Add this and update your Kotlin extension version accordingly:

    buildscript {
        ext.kotlin_version = '1.7.10'
        repositories {
            google()
            mavenCentral()
        }
    
        dependencies {
            classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
        }
    }
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search