skip to Main Content

I’ve recently upgraded my Flutter version to the newest one (3.27.1). Everything works fine when I run the app directly through IDE. But when I tried to build my app’s APK for deployment, it doesn’t work. This is the error that I’ve been getting.

 Flutter Fix ──────────────────────────────────────────────────────────────────────────────────────────┐
│ [!] Your project requires a newer version of the Kotlin Gradle plugin.                                 │
│ Find the latest version on https://kotlinlang.org/docs/releases.html#release-details, then update the  │
│ version number of the plugin with id "org.jetbrains.kotlin.android" in the plugins block of            │
│ <the location of my settings.gradle>                       │
│                                                                                                        │
│ Alternatively (if your project was created before Flutter 3.19), update                                │
│ <the location of my build.gradle>                       │
│ ext.kotlin_version = '<latest-version>' 

For my case, my project was created before Flutter 3.19, so I followed the latter option. My initial kotlin_version is 1.9.0. I changed the ext.kotlin_version to 2.1.0 (The current newest version). It then tells me to upgrade my gradle version as well, so I did. But after all that, the same error appeared telling me to upgrade my kotlin version. I tried downgrading to 1.9.22 as well but still it didn’t work.

Any help would be greatly appreciated. Thanks.

2

Answers


  1. Update Kotlin Version:

    Make sure your ext.kotlin_version in android/build.gradle is updated to the latest stable version (e.g., 1.9.10 or the latest listed on the Kotlin Releases Page).

    Example:

    gradle
    ext.kotlin_version = '1.9.10'
    

    Upgrade Gradle Version:

    Update your Gradle wrapper to match the Kotlin plugin requirements. Open android/gradle/wrapper/gradle-wrapper.properties and ensure you use the latest Gradle version (e.g., 8.1.1).

    distributionUrl=https://services.gradle.org/distributions/gradle-8.1.1-all.zip
    

    Update Gradle Plugin Version:

    In android/build.gradle, update the Gradle plugin version under classpath.

    dependencies {
        classpath 'com.android.tools.build:gradle:8.0.2'
    }
    

    Sync and Rebuild:

    After making the updates, perform a Gradle sync and rebuild the project.
    Clear Caches and Reinstall:

    If the issue persists, try clearing the Gradle cache and reinstalling

    flutter clean
    
    rm -rf ~/.gradle/caches/
    
    flutter pub get
    

    Validate Flutter Environment:

    Make sure your Flutter and Dart SDKs are updated.

    Login or Signup to reply.
  2. ┌─ Flutter Fix ────────────────────────────────────────────────────────────────────────────────┐
    │ [!] Your project requires a newer version of the Kotlin Gradle plugin. │
    │ Find the latest version on https://kotlinlang.org/docs/releases.html#release-details, then │
    │ update the │
    │ version number of the plugin with id "org.jetbrains.kotlin.android" in the plugins block of │
    │ D:Android applicationnews_appandroidsettings.gradle. │
    │ │
    │ Alternatively (if your project was created before Flutter 3.19), update │
    │ D:Android applicationnews_appandroidbuild.gradle │
    │ ext.kotlin_version = ” │
    └──────────────────────────────────────────────
    if i run the project to show me this type of error . my flutter version is 3.27.1
    after changing the kotlin = 1.9.10 , still the error .

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search