Hi guys, can anyone help me to understand if is it...
# android
d
Hi guys, can anyone help me to understand if is it safe to have kotlin
1.4.x
in some of dependencies (latest okhttp library for example) and
1.3.72
in the project and in some other dependencies too?
j
You can get away with it as long as you don't use things that are new in 1.4. You may need to exclude dependencies and force use of 1.3.72. Of course if okhttpclient starts using those features it will still break. So, you might get some run time errors. Generally either don't upgrade those libraries or upgrade to 1.4.10 on your project. I'd recommend the latter.
d
okhttp started using Functional Interfaces from Kotlin 1.4
what about the opposite situation: • the project include Kotlin 
1.4.0
• some libraries include Kotlin 
1.3.71
In that case I get warning:
Copy code
w: Runtime JAR files in the classpath should have the same version. These files were found in the classpath: /.gradle/caches/transforms-2/files-2.1/ab41544fa06f7b55dec847efe3b9899c/jetified-kotlin-stdlib-jdk7-1.3.71.jar (version 1.3) .gradle/caches/transforms-2/files-2.1/a4c6c3b949eb40b555dea1468ae75f87/jetified-kotlin-stdlib-1.4.10.jar (version 1.4) .gradle/caches/transforms-2/files-2.1/f98f62bf33e752598311020043618780/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
?
j
In that case you should be fine as Kotlin is pretty good about not breaking backward compatibility on stable APIs. Any issues would be well documented typically. The exception is things that are marked as experimental, which by definition means it can and will change between major versions. So if you are opting in to any experimental stuff, you may see some stuff breaking.
👍 1
So modify your build to exclude those transitive dependencies.