Skip to content

After update to 1.6.0-rc02 compileCommonMainKotlinMetadata fails with "Unresolved reference: launch" on CoroutineScope#launch #4326

@arkivanov

Description

@arkivanov

Describe the bug

I'm not sure if this is actually a bug or not. My module with Compose code doesn't have direct dependency on kotlinx-coroutines, as the dependency has been used to be exposed as api from Compose. As I have been able to use coroutines without adding the dependency explicitly. But after updating Compose from 1.6.0-alpha01 to 1.6.0-rc02, kotlinx.coroutines imports are unresolved and compileCommonMainKotlinMetadata task fails. Though, tasks like jvmJar, assembleDebug, jsJar, etc. - all work fine.

Affected platforms

Select one of the platforms below:

  • Common

Versions

  • Kotlin version*: 1.9.21, 1.9.22
  • Compose Multiplatform version*: 1.6.0-rc02
  • OS version(s)* (required for Desktop and iOS issues): macOS 13.5.2 (22G91)
  • OS architecture (x86 or arm64): arm64
  • JDK (for desktop issues): jbr-17

To Reproduce

Don't add kotlinx-coroutines dependency to a module with Compose.

Code:

import kotlinx.coroutines.launch

Run: ./gradlew compileCommonMainKotlinMetadata

Error:

> Task :extensions-compose:compileCommonMainKotlinMetadata FAILED
e: file:///....... Unresolved reference: coroutines

I'm also not able to use rememberCoroutineScope, the error is:

> Task :extensions-compose:compileCommonMainKotlinMetadata FAILED
e: file:///........ Cannot access class 'kotlinx.coroutines.CoroutineScope'. Check your module classpath for missing or conflicting dependencies

Expected behavior

I think it should work work fine without adding kotlinx-coroutines explicitly, but I might be wrong.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingexternal bugBug in an external software other than CM/Skikoregression

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions