Hello! I read the documentation regarding kotlin ...
# android
d
Hello! I read the documentation regarding kotlin 1.8 stdlib. “If you explicitly write the Kotlin version 1.8.0 or higher in your dependencies, for example: implementation(“org.jetbrains.kotlinkotlin stdlib1.8.0"), then the Kotlin Gradle Plugin uses this Kotlin version for transitive kotlin-stdlib-jdk7 and kotlin-stdlib-jdk8 dependencies. This is for avoiding class duplication from different stdlib versions.[Learn more about merging kotlin-stdlib-jdk7 and kotlin-stdlib-jdk8 into kotlin-stdlib.” Can someone explain how using the same version of the stdlib with transitive dependencies (stdlib 1.8 will pick up jdk7 & jdk8 with the same version) will help avoiding class duplication from different stdlib versions? Thanks
e
kotlin-stdlib:1.8+ targets Java 8. so all the contents that used to be in kotlin-stdlib-jdk7 and kotlin-stdlib-jdk8 have moved into kotlin-stdlib
d
thanks for the answer. May I ask you how it could help avoiding class duplication?
e
if you used kotlin-stdlib:1.8 and kotlin-stdlib-jdk61.7/kotlin stdlib jdk71.7 at the same time, you'd have multiple versions of those classes. but kotlin-stdlib:1.8 and kotlin-stdlib-jdk61.8/kotlin stdlib jdk71.8 is fine, because the latter are empty.
👍 1
d
thank you very much for the explanation!
@ephemient Thanks for help, I just have one small question regarding this topic: How using the stdlib-1.8.0 and KotlinGradle plugin lower than 1.8.0 could have alignment issues?
I saw this in the docs: “If you have a Kotlin version equal to 1.8.0: implementation(“org.jetbrains.kotlinkotlin stdlib1.8.0") and an old version (less than 1.8.0) of a Kotlin Gradle plugin – update the Kotlin Gradle plugin:”
e
kotlin-stdlib doesn't depend on kotlin-stdlib-jdk7/8, it's the other way around. so without plugin support, you can end up with mixed versions and problems therein
👍 1
d
Thank you!