Kotlin gradle plugin 1.2.51

I updated my Android studio to 3.2. It told me to update my kotlin gradle plugin version to 1.2.51 from 1.1.51. Now I am facing lots of type mismatch errors (e.g infered type is String? but expected String). The code was working with kotlin gradle plugin version 1.1.51.
Cant risk to change the existing codebase at this level.

Can anyone explain the reason suggest anything. Thanks in advance.

1 Like

I had the same issue and I solved it by changing the plugin version in the dependencies section of the buildscript in the build.gradle file :

buildscript {
    dependencies {
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.2.51"
    }
}

Hi!

Can you please tell some more details on the issue like sharing the pieces of code where those errors appeared?

I am gettting the following error
Launching lib\main.dart on Android SDK built for x86 in debug mode…
Initializing gradle…
Resolving dependencies…

  • Error running Gradle:
    ProcessException: Process “C:\Development\Flutter\flutter_sample\android\gradlew.bat” exited abnormally:

Configure project :map_view
WARNING: The specified Android SDK Build Tools version (27.0.3) is ignored, as it is below the minimum supported version (28.0.3) for Android Gradle Plugin 3.2.1.
Android SDK Build Tools 28.0.3 will be used.
To suppress this warning, remove “buildToolsVersion ‘27.0.3’” from your build.gradle file, as each version of the Android Gradle Plugin now has a default version of the build tools.

FAILURE: Build failed with an exception.

  • What went wrong:
    The Android Gradle plugin supports only Kotlin Gradle plugin version 1.2.51 and higher. Project ‘android’ is using version 1.1.2-4.

  • Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

  • Get more help at https://help.gradle.org

BUILD FAILED in 48s
Command: C:\Development\Flutter\flutter_sample\android\gradlew.bat app:properties

Finished with error: Please review your Gradle project setup in the android/ folder.

i have same error, please help me

FAILURE: Build failed with an exception.

  • What went wrong:
    The Android Gradle plugin supports only Kotlin Gradle plugin version 1.3.10 and higher.
    The following dependencies do not satisfy the required version:
    project ‘:barcode_scan’ → org.jetbrains.kotlin:kotlin-gradle-plugin:1.2.51

Same error, Please help