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.59k stars 1.14k forks source link

`IllegalStateException: IrPropertyPublicSymbolImpl` error in latest release - 1.6.0-beta01 #4174

Closed rdsarna closed 5 months ago

rdsarna commented 6 months ago

Describe the bug Building the iOS app via a Release build configuration fails after updating to the latest 1.6.0-beta01 version.

Affected platforms

Versions

To Reproduce A KMM project with the latest compose beta - 1.6.0-beta01. (I tried with a project built with Compose Multiplatform Wizard) Build iOS project via the Release Configuration (not debug)

The following error is seen during build -

java.lang.IllegalStateException: IrPropertyPublicSymbolImpl for androidx.collection.internal/EMPTY_INTS|6945326639149902205[0] is already bound: PROPERTY name:EMPTY_INTS visibility:internal modality:FINAL [val]

It seems like the following has been introduced in the latest release that is conflicting with a property of same name in androidx.collection. (might be wrong about the exact cause)

package androidx.compose.ui.text.caches

/**
 * Copied from ContainerHelpers.binarySearch until collection2 can be linked
 */
@kotlin.jvm.JvmField
internal val EMPTY_INTS = IntArray(0)
rdsarna commented 6 months ago

Looking into it a little bit more and comparing 1.5.11 to 1.6.0-beta01, the above mentioned code from the androidx.compose.ui.text.caches package doesn't seem to be new. It does exist in 1.5.11.

Instead, it looks like androidx.collection was added as a dependency in 1.6.0-beta01.

Here are references to EMPTY_INTS in version 1.5.11 -

Screenshot 2024-01-26 at 2 47 52 AM

And here are references to EMPTY_INTS in version 1.6.0-beta01 -

Screenshot 2024-01-26 at 2 46 57 AM

Sorry for the limited info, I haven't been able to dig too deep into this.

eymar commented 6 months ago

What libraries did you choose when configuring the porject in the wizard (here https://terrakok.github.io/Compose-Multiplatform-Wizard/)? Could you please share the project you generated where the issue can be reproduced?

rdsarna commented 6 months ago

What libraries did you choose when configuring the porject in the wizard (here https://terrakok.github.io/Compose-Multiplatform-Wizard/)? Could you please share the project you generated where the issue can be reproduced?

I've pushed the sample project that was exhibiting the issue to Github - https://github.com/rdsarna/Multiplatform-App-Issue-Example

chrislacy commented 5 months ago

My project is experiencing this in v1.6.0-beta02 also.

eymar commented 5 months ago

right, the proper fix didn't make to 1.6.0-beta2.

The possible temporary workaround could be to not use androidx.annotation:annotation and androidx.collection, but use org.jetbrains.compose.annotation-internal:annotation and org.jetbrains.compose.collection-internal:collection instead. It could be that you don't use it directly, but it's a transitive dependency. Then gradle dependencies substitution should help.

The proper fix is in progress.

chrisbanes commented 5 months ago

Just to chime in, switching the dependency to org.jetbrains.compose.collection-internal:collection:1.6.0-beta02 has worked for me.

You can automate the swap by adding the following to your Gradle setup:

val cmpVersion = ...
configurations.configureEach {
    resolutionStrategy.eachDependency {
        if (requested.group == "androidx.collection" && requested.startsWith("collection")) {
            useTarget("org.jetbrains.compose.collection-internal:collection:$cmpVersion")
        } else if (requested.group == "androidx.annotation" && requested.name.startsWith("annotation")) {
            useTarget("org.jetbrains.compose.annotation-internal:annotation:1.8.0-alpha01")
        }
    }
}
sureshmaidaragi1919 commented 5 months ago

@eymar any fixes done latest release 1.6.2?

eymar commented 5 months ago

@eymar any fixes done latest release 1.6.2?

Should work in 1.6.0

sureshmaidaragi1919 commented 5 months ago

@eymar it showing even updating to v1.6.2

Compilation failed: IrPropertyPublicSymbolImpl for androidx.collection.internal/EMPTY_INTS|{}EMPTY_INTS[0] is already bound: PROPERTY name:EMPTY_INTS visibility:internal modality:FINAL [val]

 * Source files: 
 * Compiler version: 1.9.22
 * Output kind: FRAMEWORK
eymar commented 4 months ago

@sureshmaidaragi1919 There's no Compose Multiplatform 1.6.2, there is only 1.6.0

1.6.2 - it's likely a version of Jetpack Compose

sureshmaidaragi1919 commented 4 months ago

Sorry my bad, I used 1.6.0 for KMM. Btw thank you, I found the root cause is because of another dependency Koin using older version of compose, So I need to either downgrade or should wait for koin to update, here is the full discussion