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

前端 未结 10 2005
天涯浪人
天涯浪人 2020-12-30 18:10

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 initia

相关标签:
10条回答
  • 2020-12-30 18:48

    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

    0 讨论(0)
  • 2020-12-30 18:52

    I don't know if I can do the same as KP7984 said - to check the versions of the plugins of my Android Studio, not the ones of my OS. I use gradlew -v of my project instead of gradle -v and it works for me.

    0 讨论(0)
  • 2020-12-30 18:52

    In your build.gradle file if you hover over the classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" it will tell you what version of Kotlin you will have to use in the kotlinVersion variable at the top of the file, according to your SDK/plugins versions.

    0 讨论(0)
  • 2020-12-30 18:53

    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.

    0 讨论(0)
  • 2020-12-30 18:54

    In Android Studio: File -> Project Structure -> Variables

    There edit the kotlin_version to e.g. 1.3.72

    Gradle should resync automatically, otherwise resync manually

    0 讨论(0)
  • 2020-12-30 19:02

    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()
    }
    ... 
    }
    
    0 讨论(0)
提交回复
热议问题