Reputation: 10493
I am getting the following error while building my android studio project.
Any idea how to resolve these?
Task :app:compileDebugKotlin w: Runtime JAR files in the classpath should have the same version. These files were found in the classpath: /Users/arpit/.gradle/caches/transforms-2/files-2.1/2f0acfdb5ca832ed018dc4bc38a13985/jetified-kotlin-stdlib-jdk8-1.3.61.jar (version 1.3) /Users/arpit/.gradle/caches/transforms-2/files-2.1/cf0b910eaf7d073f4207081a72f8fccf/jetified-kotlin-stdlib-jdk7-1.3.61.jar (version 1.3) /Users/arpit/.gradle/caches/transforms-2/files-2.1/7f0de453ba67b933d609d2948e77e8ae/jetified-kotlin-stdlib-1.4.10.jar (version 1.4) /Users/arpit/.gradle/caches/transforms-2/files-2.1/28dd71f1078961ee52c8b9a5ea1ba04a/jetified-kotlin-stdlib-common-1.4.10.jar (version 1.4) w: Some runtime JAR files in the classpath have an incompatible version. Consider removing them from the classpath
Upvotes: 4
Views: 10185
Reputation: 1
I just switched "Source Compatibility" and "Target Compatibility" to $VERSION_1_7 and back to $VERSION_1_8 again. And it solved all this errors.
You can change "Source Compatibility" and "Target Compatibility" in File > Project Structure > Modules
Upvotes: 0
Reputation: 408
Maybe there is a problem in your project structure.
In android studio File > Project Structure... > Modules > 'your_module_android' > Dependencies
Check the KotlinJavaRuntime box.
Upvotes: 0
Reputation: 39
I'm facing the same warning in my backend project with Kotlin.
I've changed Kotlin version to 1.4.10 and warning starts to appears on each test run. Probably there is some transitive dependency that brings in classpath jars with an older version of Kotlin. In my case in classpath I've found kotlin-reflect 1.3.* that isn't required for the current project but Gradle when compiles take always the same class path from ~/.gradle and probably makes assumtion that something could go wrong in runtime. I've solved by adding kotlin-reflect dependency with the same version of Kotlin jvm target. It's ugly because I don't need kotlin-reflect but the warning has been desapeared and I'm happy about that.
Upvotes: 2