Should I use Kotlin 1.4.21 in my project with Andr...
# android
a
Should I use Kotlin 1.4.21 in my project with Android Studio 4.1.1, Gradle 6.5 and the Android Gradle plugin 4.1.1? My builds have lines like the following:
w: Runtime JAR files in the classpath should have the same version. These files were found in the classpath:
/Users/snip/.gradle/caches/transforms-2/files-2.1/bac97eb1605b4833d56979273f673da2/jetified-kotlin-stdlib-jdk7-1.4.21.jar (version 1.4)
/Users/snip/.gradle/caches/transforms-2/files-2.1/924035e17cc9c5fe36bf2b18b22aa2fb/jetified-kotlin-reflect-1.3.50.jar (version 1.3)
/Users/snip/.gradle/caches/transforms-2/files-2.1/0e4359b74f91d4fdd98cefa0d215fe0c/jetified-kotlin-stdlib-1.4.21.jar (version 1.4)
/Users/snip/.gradle/caches/transforms-2/files-2.1/84264f1288926d1cb0c7b30f75e01627/jetified-kotlin-stdlib-common-1.4.21.jar (version 1.4)
w: Some runtime JAR files in the classpath have an incompatible version. Consider removing them from the classpath
k
Take out the kotlin stdlib in your Gradle files... It's included automatically by kotlin 1.4
a
Thanks @kenkyee, I’ve removed the
implementation  org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.4.21
from all of the build.gradle’s, but my top-level build.gradle still has:
Copy code
buildscript {
   dependencies {
      classpath org.jetbrains.kotlin:kotlin-gradle-plugin:1.4.21
...
and I’m still getting the warning. Should I be using 1.4.21 or 1.3.72 ?
f
You can update plugin Kotlin 1.4.21 and restart Android Studio. It will be normal.
And you should use
Copy code
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
replace your implement, and add more
Copy code
kotlinOptions {
        jvmTarget = '1.8'
    }
in android {… } of app/build.gradle
j
@Fatty you should remove
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
in its entirety as it is automatically included since 1.4 (which will be good for 99% of users)
☝️ 1
f
@Joost Klitsie oh, I try to remove it, It is good for me, thank you @Joost Klitsie. I think
Android Studio
tool should remove it when we create one project