Kotlin gradle Could not initialize class class org.jetbrains.kotlin.gradle.internal.KotlinSourceSetProviderImplKt

Solution 1:

Solved this issue by setting the latest Kotlin version (1.3.72) in build.gradle file.

buildscript {
ext {
    kotlinVersion = '1.4.20'
    springBootVersion = '2.0.4.RELEASE'
}
repositories {
    mavenCentral()
}
... 
}

Solution 2:

I just had the same issue. On windows, I checked the kotlin version from the command line with gradle -v and then adjusted the kotlin version in build.gradle of my project to match my version of gradle.

I hope this works for you too.

Solution 3:

in my case it solves the problem:

buildscript {
    ext.kotlin_version = "1.3.72"
    repositories {
        google()
        jcenter()

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

    }
}

set ext.kotlin_version = "1.3.72" and $kotlin_version

Solution 4:

Yes, as many before have said, the problem is probably that you have a kotlin version mis-match. But how do you know what version of kotlin is installed?

To find out your version of kotlin: Settings -> Language & Frameworks -> Kotlin

picture of settings

Make sure that you change your kotlin version (in both build.gradle files!) to this exact number. In my case (above) it's 1.4.10

Good luck!