I've just enabled Kotlin in my Android project and I stumbled upon a warning. After the second build (Build -> Rebuild Project) this warning is shown under Messages:
Warning:Runtime JAR files in the classpath should have the same version. These files were found in the classpath:
~/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib-jdk8/1.2.10/85fe1811f3e586d0cc53aba1394d8089f1862215/kotlin-stdlib-jdk8-1.2.10.jar (version 1.2)
~/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-reflect/1.2.10/19bc012f8c4cd6b705bd6512263777cc19bcf259/kotlin-reflect-1.2.10.jar (version 1.2)
/Applications/Android Studio.app/Contents/gradle/m2repository/org/jetbrains/kotlin/kotlin-stdlib-jre7/1.1.51/kotlin-stdlib-jre7-1.1.51.jar (version 1.1)
~/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib-jdk7/1.2.10/cfe8b616b3bf0811ef70863c86b745a2e767a66e/kotlin-stdlib-jdk7-1.2.10.jar (version 1.2)
~/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib/1.2.10/b9bf650516989595a5390e5a54181e16347208ac/kotlin-stdlib-1.2.10.jar (version 1.2)
It seems like the second build includes the outdated kotlin-stdlib-jre7-1.1.51.jar
from cache. After a clean build (Build -> Clean Project) the warning is gone, and the next Rebuild Project brings it up again.
I'm using Android Studio 3.0.1 and I explicitly include the Kotlin dependencies with version:
build.gradle
buildscript {
ext {
// shared build properties
kotlin_version = '1.2.10'
buildToolsVersion = '27.0.2'
minSdkVersion = 15
targetSdkVersion = 27
compileSdkVersion = 27
}
repositories {
jcenter()
google()
}
dependencies {
classpath "com.android.tools.build:gradle:3.0.1"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:${kotlin_version}"
}
}
app/build.gradle
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-kapt'
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:${kotlin_version}"
implementation "org.jetbrains.kotlin:kotlin-reflect:${kotlin_version}"
[...]
}
Also on our travis builds the warning is shown. Thus, it is not only a problem with my local setup. Even if it is only a warning, I don't feel comfortable by releasing an apk that includes conflicting versions.