Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

I tried to use gradle for transpiling Kotlin to Js. When I run the example from https://www.codeflow.site/fr/article/kotlin-javascript I got the error : Could not initialize class org.jetbrains.kotlin.gradle.internal.KotlinSourceSetProviderImplKt which comes from line apply plugin: 'kotlin2js' of build.gradle.

I have no idea of what the missing class is and why kotlin2js is asking for it. Any suggestion ?

like image 989
Emile Achadde Avatar asked Mar 24 '20 14:03

Emile Achadde


2 Answers

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()
}
... 
}
like image 199
Liebster Kamerad Avatar answered Nov 11 '22 02:11

Liebster Kamerad


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.

like image 35
KP7984 Avatar answered Nov 11 '22 03:11

KP7984