Why do I have different versions of Kotlin JAR in classpath?

I decided to add a couple of Kotlin files to an existing Java Android project in AS 3.0.

As soon as I added the Kotlin files, I let the assistant add the appropriate lines to my files build.gradle, in particular:

project build.gradle

buildscript {
    ext.kotlin_version = '1.2.21'
    //...
    dependencies {
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"

app build.gradle

// top of file
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
//....
dependencies {
    compile "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"

Unfortunately, all assemblies now raise this warning:

Warning:Runtime JAR files in the classpath should have the same version. These files were found in the classpath:
/Users/sddsfsd/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib-jdk7/1.2.21/88bfff5aa470143a83b0bc5ec00c0be8cabd7cad/kotlin-stdlib-jdk7-1.2.21.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)
/Users/sddsfsd/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib/1.2.21/d64187eb2d9d1521be3421aa8c6774a8625cdde8/kotlin-stdlib-1.2.21.jar (version 1.2)

Why does Android Studio have its old version of Kotlin in the classpath? How to remove it?

+4
source share
1 answer

Why do I have different versions of the Kotlin JAR in the classpath?

You have different versions because some of your dependencies depend on Kotlin 1.1 version.

Why does Android Studio have its own old version of Kotlin in Classpath? How to remove it?

, stdlib-jre7 .

Kotlin - :

JAR Runtime .

JAR .

.

, , , 1.1 1.0 .

, . .

, , :

AS 3.1

./gradlew -q dependencies app:dependencies --configuration variantDebugCompileClasspath

enter image description here

enter image description here

enter image description here

enter image description here

Realm 4.3.2.

. , , , .

+2

Source: https://habr.com/ru/post/1693079/


All Articles