https://kotlinlang.org logo
#compose
Title
# compose
m

Marco Pierucci

03/09/2023, 7:13 PM
Are latest 1.4.x compose library intentionally pulling newer kotlin versions? I'm getting
Copy code
Duplicate class kotlin.collections.jdk8.CollectionsJDK8Kt found in modules jetified-kotlin-stdlib-1.8.10 (org.jetbrains.kotlin:kotlin-stdlib:1.8.10) and jetified-kotlin-stdlib-jdk8-1.7.10 (org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.7.10)
When trying to update to 1.4.0-rc01 (or betas) from 1.3.1 (compiler version is 1.3.1 and kotlin is 1.7.10) This does not seems to be the case with alpha versions
e

efemoney

03/10/2023, 7:54 AM
From kotlin 1.8 there is no jdk8 stdlib anymore, it’s merged into the standard stdlib module. 1.4 also depends on kotlin 1.8 so if your code still has a dependency on 1.7 jdk8 you will see duplicate classes. Upgrade your kotlin version and remove usages of jdk8 module
m

Marco Pierucci

03/10/2023, 7:59 AM
I thought the idea of having compose compiler library with independent versions was so that we can upgrade compose without forcing a kotlin upgrade?
what if I cant update kotlin right now ( like my case)
e

efemoney

03/10/2023, 8:00 AM
1.4 compiler is mapped to kotlin 1.8, if you are 1.7 use the correct compiler
m

Marco Pierucci

03/10/2023, 8:01 AM
Im using compiler 1.3.1 not 1.4
Im not upgrading the compiler version just the other library oin case that was not clear
e

efemoney

03/10/2023, 8:02 AM
Ah okay, not sure where the dependency is coming from then
What do you mean the other libraries?
m

Marco Pierucci

03/10/2023, 8:03 AM
foundation, ui, runtime
e

efemoney

03/10/2023, 8:04 AM
Oh I see, maybe run ./gradlew dependencies and check if they depend on kotlin stdlib
(My guess is that they do)
I mean they kinda have to depend on the kotlin stdlib. It would be insane to think otherwise. Also I do not think the compiler is forward compatible (probably only backward) so you are in very dangerous waters using an old compiler for a new runtime
m

Marco Pierucci

03/10/2023, 8:13 AM
Copy code
Compose and Kotlin are highly coupled, and we've heard your feedback that Compose compiler updates are needed to allow you to upgrade your Kotlin version. We want to make sure that you can use the latest and greatest features (and bug fixes) from both Compose and Kotlin, which is why we plan to release stable versions of the Compose Compiler on a much more regular basis. This means the Compose Compiler version numbers will progress at a faster pace than most other Compose libraries. Since the Compose Compiler is both forwards and backwards compatible, you will be able to upgrade it as soon as a new version is released.
anyways, thanks
a

Albert Chang

03/10/2023, 8:15 AM
AndroidX always uses the latest Kotlin version.
I thought the idea of having compose compiler library with independent versions was so that we can upgrade compose without forcing a kotlin upgrade?
Actually it's the opposite. You can upgrade Kotlin version without upgrading Compose.
m

Marco Pierucci

03/10/2023, 8:18 AM
again from the above blog
Copy code
easier to incrementally upgrade your application and therefore stay up-to-date with the latest Compose features.
The release is both *backwards and forwards compatible*
Seems that this would break forward compatibly,
but agan, thanks anywas Ill try to update kotlin eventually and move forward
cheers
264 Views