PreCompose icon indicating copy to clipboard operation
PreCompose copied to clipboard

Unable to compile JVM app with the new libraries 1.x.x

Open cmota opened this issue 3 years ago • 10 comments

Hello!

It's great to see the new updates in PreCompose - thank you! 🙂

I'm trying to test the new updates, but when I try to run the desktop app I'm getting:

Error: LinkageError occurred while loading main class MainKt
        java.lang.UnsupportedClassVersionError: MainKt has been compiled by a more recent version of the Java Runtime (class file version 61.0), this version of the Java Runtime only recognizes class file versions up to 55.0

I'm able to replicate this error in the sample project, by using the remote version of PreCompose, instead of the local one.

Briefly, on sample/desktop/build.gradle.kts file, I've changed the implementation to:

implementation("moe.tlaster:precompose:1.1.4")

I also tried the different versions that you've released starting with 1.0.0.

I tested different Java versions, from older to newer and the only thing that changed was the 55.0 number, which was continuously updated to the one that I was using.

Any idea, on what might be wrong?

cmota avatar Jun 13 '22 16:06 cmota

I also face the same problem when using IntelliJ with JDK 17, it errors everywhere, but compile seems to be fine. It seems that JDK 17 is just too early to use, back to JDK 11 is better.

Tlaster avatar Jun 14 '22 02:06 Tlaster

Hi, can you try version 1.1.5, it should fix both of your issues.

Tlaster avatar Jun 14 '22 14:06 Tlaster

Thank you! I'm testing with 1.2.1 and now I'm seeing:

e: Pre-release classes were found in dependencies. Remove them from the classpath, recompile with a release compiler or use '-Xskip-prerelease-check' to suppress errors

I needed to add to the root build.gradle.kts file:

subprojects {
    tasks.withType<KotlinCompile> {
        kotlinOptions {
            jvmTarget = "11"
            freeCompilerArgs += listOf("-Xskip-prerelease-check")
        }
    }
}

And I'm also using Kotlin 1.6.21.

Any idea on what might be causing this @Tlaster ?

cmota avatar Jun 21 '22 14:06 cmota

I also have the same issue, but currently, I have no idea why, since PreCompose uses Kotlin 1.6.21, I don't know where these Pre-release classes come from.

Tlaster avatar Jun 22 '22 16:06 Tlaster

Hi @Tlaster, that warning comes from the compose-jb. You're using 1.2.0 which is still a pre release version.

Reverting compose-jb to 1.1.1 will probably mitigate the issue, however, it is probably also advisable to downgrade kotlin to 1.6.10.

Great work on the lib by the way 💪 .

tiper avatar Jul 18 '22 11:07 tiper

Hi @Tlaster, that warning comes from the compose-jb. You're using 1.2.0 which is still a pre release version.

Reverting compose-jb to 1.1.1 will probably mitigate the issue, however, it is probably also advisable to downgrade kotlin to 1.6.10.

Great work on the lib by the way 💪 .

Reverting compose-jb to 1.1.1 seems impossible since it was months ago and compose itself changes a lot. Better wait for a stable release of compose-jb 1.2.0

Tlaster avatar Jul 19 '22 04:07 Tlaster

From what I was able to check, the lib doesn't seem to be using anything that depends from 1.2.0.

The iOS sample, on the other hand, does, since it's using the experimental.

You could have a "stable" release using compose 1.1.1 and kotlin 1.6.10, and exclude the iOS sample, and keep master using with the experimental version.

This way if anyone is interested this for their projects they could do so without having those annoying warnings.

tiper avatar Jul 19 '22 09:07 tiper

From what I was able to check, the lib doesn't seem to be using anything that depends from 1.2.0.

The iOS sample, on the other hand, does, since it's using the experimental.

You could have a "stable" release using compose 1.1.1 and kotlin 1.6.10, and exclude the iOS sample, and keep master using with the experimental version.

This way if anyone is interested this for their projects they could do so without having those annoying warnings.

This is a good solution, but the version naming is quite difficult since PreCompose is now 1.2.3, which is using compose 1.2.0 and it's a stable version. If I have a release base on 1.1.1, what's the proper version name for this?

Tlaster avatar Jul 19 '22 09:07 Tlaster

Why not keep moving forward? Like you said, the lib itself is stable, it's dependencies are the ones who are not. Basically you're downgrading them to fix a minor issue. So the next release would be 1.2.4.

Btw I've created a PR if you're interested.

tiper avatar Jul 19 '22 10:07 tiper

What would i need to do to make my app work while we're waiting on compose-jb?

Pival81 avatar Jul 29 '22 08:07 Pival81

What would i need to do to make my app work while we're waiting on compose-jb?

The latest version should work without any problem. Closing as stale

Tlaster avatar Sep 08 '22 01:09 Tlaster