Setup kotlin project with gradle

前端 未结 1 1174
遥遥无期
遥遥无期 2020-12-17 23:21

I\'m new to kotlin and gradle and tried to set up my very first project:

build.gradle

buildscript {
   ext.kotlin_version = \'1.0.1-1\'

   repositor         


        
相关标签:
1条回答
  • 2020-12-17 23:45

    The reference is missing the kotlin-stdlib dependency. It is not added automatically.

    kotlin-gradle-plugin buildscript dependency is only Gradle plugin for Kotlin builds, and it doesn't add any dependencies to your project code. In order to use the standard library, one should add it as a dependency.

    Append the following to your build.gradle:

    repositories {
        jcenter()
    }
    
    dependencies {
        compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
    }
    

    (jcenter() is needed again, these repositories are different from those in buildscript)

    0 讨论(0)
提交回复
热议问题