0

I have a project written in java I am integrating kotlin with using gradle. I am trying to follow https://kotlinlang.org/docs/reference/using-gradle.html

My build.gradle

buildscript {
ext.kotlin_version = '1.1.51'
repositories {
    jcenter()
}
dependencies {
    classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
apply plugin: "kotlin"
dependencies {
compile "org.jetbrains.kotlin:kotlin-stdlib-jre7"
}

according to Kotlin Error : Could not find org.jetbrains.kotlin:kotlin-stdlib-jre7:1.0.7 the library is only available in kotlin v1.1 and up. When I deploy this library and use it in my android project I get the error in the title.

Marc
  • 219
  • 1
  • 13

2 Answers2

2

you need to replace

compile "org.jetbrains.kotlin:kotlin-stdlib-jre7"  

with

compile "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
humazed
  • 70,785
  • 32
  • 93
  • 133
0

Starting with Kotlin 1.1.2 and if you're targeting JDK 7 or JDK 8, you can use extended versions of the Kotlin standard library which contain additional extension functions for APIs added in new JDK versions. Use one of the following dependencies:

compile "org.jetbrains.kotlin:kotlin-stdlib-jdk7"
compile "org.jetbrains.kotlin:kotlin-stdlib-jdk8"
0xAliHn
  • 18,256
  • 21
  • 87
  • 110