JetBrains / compose-multiplatform

Compose Multiplatform, a modern UI framework for Kotlin that makes building performant and beautiful user interfaces easy and enjoyable.
https://jetbrains.com/lp/compose-multiplatform
Apache License 2.0
15.9k stars 1.15k forks source link

[JS] Could not find "androidx.compose.runtime:runtime" in [/home/user/.local/share/kotlin/daemon] #2641

Open mpetuska opened 1 year ago

mpetuska commented 1 year ago

EDIT: Looks like there was some breaking binary compatability change here. The issue was cause by a dependency compiled with CfW 1.2.1

When trying out kotlin 1.8.0 and CfW 1.3.0-rc2 on my various projects, one of them keeps failing with the following error (the project is KMP with js target only)

e: Could not find "androidx.compose.runtime:runtime" in [/home/user/.local/share/kotlin/daemon]
e: java.lang.IllegalStateException: FATAL ERROR: Could not find "androidx.compose.runtime:runtime" in [/home/user/.local/share/kotlin/daemon]
        at org.jetbrains.kotlin.ir.backend.js.KlibKt$resolverLogger$1.fatal(klib.kt:101)
        at org.jetbrains.kotlin.library.KotlinLibrarySearchPathResolver.resolve(SearchPathResolver.kt:175)
        at org.jetbrains.kotlin.library.SearchPathResolver.resolve$default(SearchPathResolver.kt:20)
        at org.jetbrains.kotlin.library.SearchPathResolverKt.resolve(SearchPathResolver.kt:29)
        at org.jetbrains.kotlin.library.resolver.impl.KotlinLibraryResolverImpl$resolveDependencies$2$2.invoke(KotlinLibraryResolverImpl.kt:122)
        at org.jetbrains.kotlin.library.resolver.impl.KotlinLibraryResolverImpl$resolveDependencies$2$2.invoke(KotlinLibraryResolverImpl.kt:122)
        at kotlin.sequences.TransformingSequence$iterator$1.next(Sequences.kt:210)
        at kotlin.sequences.FilteringSequence$iterator$1.calcNext(Sequences.kt:170)
        at kotlin.sequences.FilteringSequence$iterator$1.hasNext(Sequences.kt:194)
        at kotlin.sequences.TransformingSequence$iterator$1.hasNext(Sequences.kt:214)
        at kotlin.sequences.FilteringSequence$iterator$1.calcNext(Sequences.kt:169)
        at kotlin.sequences.FilteringSequence$iterator$1.hasNext(Sequences.kt:194)
        at kotlin.sequences.SequencesKt___SequencesKt.toCollection(_Sequences.kt:787)
        at kotlin.sequences.SequencesKt___SequencesKt.toMutableList(_Sequences.kt:817)
        at kotlin.sequences.SequencesKt___SequencesKt.toList(_Sequences.kt:808)
        at org.jetbrains.kotlin.library.resolver.impl.KotlinLibraryResolverImpl.resolveDependencies(KotlinLibraryResolverImpl.kt:135)
        at org.jetbrains.kotlin.library.resolver.impl.KotlinLibraryResolverImpl.resolveWithDependencies(KotlinLibraryResolverImpl.kt:44)
        at org.jetbrains.kotlin.ir.backend.js.JsLibraryResolverKt.jsResolveLibraries(JsLibraryResolver.kt:51)
        at org.jetbrains.kotlin.ir.backend.js.ModulesStructure.<init>(klib.kt:603)
        at org.jetbrains.kotlin.ir.backend.js.KlibKt.prepareAnalyzedSourceModule(klib.kt:498)
        at org.jetbrains.kotlin.ir.backend.js.KlibKt.prepareAnalyzedSourceModule$default(klib.kt:488)
        at org.jetbrains.kotlin.cli.js.K2JsIrCompiler.doExecute(K2JsIrCompiler.kt:331)
        at org.jetbrains.kotlin.cli.js.K2JSCompiler.doExecute(K2JSCompiler.java:183)
        at org.jetbrains.kotlin.cli.js.K2JSCompiler.doExecute(K2JSCompiler.java:72)
        at org.jetbrains.kotlin.cli.common.CLICompiler.execImpl(CLICompiler.kt:101)
        at org.jetbrains.kotlin.cli.common.CLICompiler.execImpl(CLICompiler.kt:47)
        at org.jetbrains.kotlin.cli.common.CLITool.exec(CLITool.kt:101)
        at org.jetbrains.kotlin.incremental.IncrementalJsCompilerRunner.runCompiler(IncrementalJsCompilerRunner.kt:213)
        at org.jetbrains.kotlin.incremental.IncrementalJsCompilerRunner.runCompiler(IncrementalJsCompilerRunner.kt:84)
        at org.jetbrains.kotlin.incremental.IncrementalCompilerRunner.doCompile(IncrementalCompilerRunner.kt:424)
        at org.jetbrains.kotlin.incremental.IncrementalCompilerRunner.compileImpl(IncrementalCompilerRunner.kt:360)
        at org.jetbrains.kotlin.incremental.IncrementalCompilerRunner.compileNonIncrementally(IncrementalCompilerRunner.kt:242)
        at org.jetbrains.kotlin.incremental.IncrementalCompilerRunner.compile(IncrementalCompilerRunner.kt:98)
        at org.jetbrains.kotlin.incremental.IncrementalCompilerRunner.compile$default(IncrementalCompilerRunner.kt:80)
        at org.jetbrains.kotlin.daemon.CompileServiceImplBase.execJsIncrementalCompiler(CompileServiceImpl.kt:566)
        at org.jetbrains.kotlin.daemon.CompileServiceImplBase.access$execJsIncrementalCompiler(CompileServiceImpl.kt:101)
        at org.jetbrains.kotlin.daemon.CompileServiceImpl.compile(CompileServiceImpl.kt:1837)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:568)
        at java.rmi/sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:360)
        at java.rmi/sun.rmi.transport.Transport$1.run(Transport.java:200)
        at java.rmi/sun.rmi.transport.Transport$1.run(Transport.java:197)
        at java.base/java.security.AccessController.doPrivileged(AccessController.java:712)
        at java.rmi/sun.rmi.transport.Transport.serviceCall(Transport.java:196)
        at java.rmi/sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:587)
        at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:828)
        at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.lambda$run$0(TCPTransport.java:705)
        at java.base/java.security.AccessController.doPrivileged(AccessController.java:399)
        at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:704)
        at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
        at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
        at java.base/java.lang.Thread.run(Thread.java:833)

w: Detected multiple Kotlin daemon sessions at build/kotlin/sessions

FAILURE: Build failed with an exception.

Oddly enough, this is the only project of multiple similar ones I've tried 1.3.0-rc2 with.

hfhbd commented 1 year ago

@mpetuska Do you use some dependencies like routing-compose?

// build.gradle.kts
plugins {
   id("org.jetbrains.kotlin.js") version "1.8.0"
   id("org.jetbrains.compose") version "1.3.0-rc2"
}

kotlin {
    js(IR) {
        browser {
            binaries.executable()
        }
    }
}

dependencies {
    implementation(compose.web.core)
    implementation("app.softwork:routing-compose:0.2.10") // uses Kotlin 1.7.20 and Compose 1.2.1
}

With this dependency, my build fails too.

mpetuska commented 1 year ago

Ah, indeed I do! Let me try to remove it.

hfhbd commented 1 year ago

Looks like a binary incompatible change/problem: I published a new release of routing-compose 0.2.11 using Kotlin 1.8.0 and Compose 1.3.0-rc02 and the build does not fail anymore...

mpetuska commented 1 year ago

Yeah, the routing-compose was an issue. Thanks for being so quick to push an update. I can confirm that the error is gone after upgrading.

hfhbd commented 1 year ago

I won't close it because now every dependency has to be updated. Maybe there is a option to fix this bug.

wakaztahir commented 1 year ago

I am encountering this issue , had to update all my dependencies that I made to kotlin 1.8 and latest compose version and it worked

Queatz commented 1 year ago

Error went away for me when updating to app.softwork:routing-compose:0.2.11

jschneider commented 1 year ago

I run into the same error message. But this is the problem: https://youtrack.jetbrains.com/issue/KT-43500

I have been using a compileOnly dependency. Just leaving this comment here, because this ticket pops up when searching for the error message...

okushnikov commented 2 weeks ago

Please check the following ticket on YouTrack for follow-ups to this issue. GitHub issues will be closed in the coming weeks.