Upgrading to `1.2.0-alpha01-dev748` is failing wit...
# compose-desktop
j
Upgrading to
1.2.0-alpha01-dev748
is failing with
Copy code
This version (1.2.0) of the Compose Compiler requires Kotlin version 1.7.0 but you appear to be using Kotlin version 1.7.10 which is not known to be compatible.  Please fix your configuration (or `suppressKotlinVersionCompatibilityCheck` but don't say I didn't warn you!).
Meanwhile
1.2.0-alpha01-dev745
is working correctly 🤔
a
k
Exactly what it says, there is no version officially compatible with 1.7.10
j
ah, I was thinking that the old one was already compatible with 1.7.10
👍🏻 1
Is it planned to get a release with that support soon?
Looks like it is already merged, so I guess it will be released soon https://android-review.googlesource.com/c/platform/frameworks/support/+/2146844
j
FWIW, the compose compiler published by Google should work when building Compose for Desktop apps, and does support Kotlin 1.7.0
I know compose-mpp uses a different gradle plugin, I haven't investigated how to swap out the compiler, but seems likely there is some gradle incantation to do it, if anyone has any thoughts and wants to share.
j
should be great to know how to do that, until know I am only using the Gradle plugin from JetBrains, hope google and jetbrains merge them into a “single” artifact in the future
a
It's possible to swap the compiler plugin, but the original question is about building against Kotlin 1.7.10, which is not possible with either plugin, isn't it?
j
The dev builds have supported 1.7.10 for a while
a
Alright then, the approach can be found here - https://github.com/JetBrains/compose-jb/issues/2108
However compilation may randomly fail because the non-android compose targets somehow depend on Kotlin version as well.
j
I'm not sure what you mean, can you elaborate? Compose-desktop and compose-android binaries should both be compatible with future versions of the kotlin stdlib, and the same compiler should work with both targets.
a
I mean, using different versions of the compiler plugin is possible with Android Jetpack Compose, there is even a Gardle API. But there is no official API for MPP Compose (AFAIK), and it looks like compose is still coupled with a certain compiler plugin and so with the Kotlin version.
j
When you say "MPP Compose", can we be specific here? Are we talking about compose-desktop or something else?
Did you try swapping out the compiler as suggested in https://github.com/JetBrains/compose-jb/issues/2108#issuecomment-1157978869 ?
Copy code
allprojects {
    configurations.all {
        resolutionStrategy.dependencySubstitution {
            substitute(module("org.jetbrains.compose.compiler:compiler")).apply {
                using(module("androidx.compose.compiler:compiler:1.2.1-dev-k1.7.10-27cf0868d10"))
            }
        }
    }
}
And adding the repository as per https://github.com/jimgoog/ComposeAppUsingPrereleaseComposeCompiler/blob/main/settings.gradle#L17
a
By MPP compose I mean the one published in https://maven.pkg.jetbrains.space/public/p/compose/dev
a
Yes I tried swapping a few weeks ago, there were various compilation errors described in that issue, especially with Compose for Web
Sorry, not compilation errors, but compiler crashes
j
Ok, yeah, the google binaries will work for compose-android and compose-desktop, those compiler binaries don't yet support web or ios, which is why I was repeatedly being explicit about compose-desktop despite being in the compose-desktop channel, and was asking for confirmation about what you mean when talking about MPP.
I think we're in agreement.
We're looking into what @Javier was mentioning, if it would be possible to ship a single artifact
👀 1
a
TBH, there was an NPE error during Gradle sync with Compose for Desktop, it was fixed later with a release officially compatible with Kotlin 1.7.0.
j
that plus AGP integrated into KGP KMP plugin would be a nice 2022 for KMP
j
TBH, there was an NPE error during Gradle sync with Compose for Desktop, it was fixed later with a release officially compatible with Kotlin 1.7.0. (edited)
Compose Compiler versions are not expected to be compatible with any version of the Kotlin Compiler except that with which they were built/documented to support. The Kotlin-stdlib is stable, so Compose libraries compiled against the old kotlin-stdlib should work with newer kotlin-stdlibs.
that plus AGP integrated into KGP KMP plugin would be a nice 2022 for KMP
Yeah, something like that. We're looking at what it would take to unify the configurations too.
❤️ 2
a
Compose Compiler versions are not expected to be compatible with any version of the Kotlin Compiler except that with which they were built/documented to support. The Kotlin-stdlib is stable, so Compose libraries compiled against the old kotlin-stdlib should work with newer kotlin-stdlibs.
Of course. I was upgrading from Kotlin 1.6.10 to Kotlin 1.7.0, there was a dev build of the Jetpack Compose compiler for Kotlin 1.7.0. I bumped the Kotlin version to 1.7.0, and used the trick to substitute the Compose compiler for Kotlin 1.7.0, while keeping all Compose artifacts of version 1.1.1, and Gradle sync was failing with NPE.
My point is, as long as there is no official Gradle API to change the Compose compiler version for MPP Compose (e.g. android + desktop), you are doing it on your own risk 😁
There is also a comment in that issue:
I am using Compose with Kotlin 1.7.0 and it's working great. You need to use the latest build 1.2.0-alpha01-dev709. And for the compose compiler you need to use version 1.2.0-dev-k1.7.0-53370d83bb1 from here: https://androidx.dev/storage/compose-compiler/repository
I remember, I also had to bump the Compose version from the stable 1.1.1 to the latest 1.2.0-alpha to make everything working.