InsertKoinIO / koin

Koin - a pragmatic lightweight dependency injection framework for Kotlin & Kotlin Multiplatform
https://insert-koin.io
Apache License 2.0
8.98k stars 710 forks source link

> Task :composeApp:compileKotlinIosSimulatorArm64 FAILED error: Could not find "org.jetbrains.compose.annotation-internal:annotation" #1843

Closed kk-777-1127 closed 5 months ago

kk-777-1127 commented 5 months ago

Describe the bug

> Task :composeApp:compileKotlinIosSimulatorArm64 FAILED
error: Could not find "org.jetbrains.compose.annotation-internal:annotation" in [/Users/{HOME}/dev/playground/KMPFullPlayGround, /Users/{HOME}.konan/klib, /Users/{HOME}/.konan/kotlin-native-prebuilt-macos-aarch64-1.9.22/klib/common, /Users/{HOME}/.konan/kotlin-native-prebuilt-macos-aarch64-1.9.22/klib/platform/ios_simulator_arm64]

Only iOS.

To Reproduce Steps to reproduce the behavior:

  1. Create kmp project using current kmp wizard, using current default libs.versions.toml
  2. Add Koin dependencies, injection code
    
    // commonMain
    expect fun platformModule(): Module

fun initKoin(appDeclaration: KoinAppDeclaration = {}) = startKoin { modules(commonModule()) appDeclaration() }

// called by iOS client fun initKoin() = initKoin() {}

fun commonModule() = module { includes(platformModule()) }

// kotlinwasm, android, ios Mains actual fun platformModule(): Module = ...

3. build app to ios simulator.

**Expected behavior**
Build Success

**Koin module and version:**

koin = "3.6.0-wasm-alpha2" koin-android = { module = "io.insert-koin:koin-android", version.ref = "koin" } koin-workmanager = { module = "io.insert-koin:koin-androidx-workmanager", version.ref = "koin" } koin-compose = { module = "io.insert-koin:koin-androidx-compose", version.ref = "koin-compose-multiplatform" } koin-compose-multiplatform = { module = "io.insert-koin:koin-compose", version.ref = "koin-compose-multiplatform" } koin-core = { module = "io.insert-koin:koin-core", version.ref = "koin" } koin-test = { module = "io.insert-koin:koin-test", version.ref = "koin" } koin-test-junit4 = { module = "io.insert-koin:koin-test-junit4", version.ref = "koin" }


**Snippet or Sample project to help reproduce**
https://github.com/kk-777-1127/PlayGround/tree/main/KMPFullPlayGround

--- 

I found following issures.
https://github.com/JetBrains/compose-multiplatform/issues/4277
> The solution is to find the dependency that depend on 1.6.0-beta02 and downgrade it or ask the author of the library to upgrade it

and , check koin dependencies.

--- io.insert-koin:koin-compose:3.6.0-wasm-alpha2 --- io.insert-koin:koin-compose-wasm-js:3.6.0-wasm-alpha2 +--- io.insert-koin:koin-core:3.6.0-wasm-alpha2 () +--- org.jetbrains.kotlin:kotlin-stdlib:1.9.22 () --- org.jetbrains.compose.runtime:runtime:1.6.0-beta01 --- org.jetbrains.compose.runtime:runtime-wasm-js:1.6.0-beta01 +--- org.jetbrains.compose.collection-internal:collection:1.6.0-beta01 | --- org.jetbrains.compose.collection-internal:collection-wasm-js:1.6.0-beta01


Koin may depends on compose 1.6.0-beta01. Does this seem relevant?
sergiocasero commented 5 months ago

Save issue here, did you find how to solve it?

Looks like it is solved in 3.6.0 branch:

https://github.com/InsertKoinIO/koin/blob/1d86518e337b4a09692ae11384c36caa46814ac4/projects/gradle/libs.versions.toml#L22

kk-777-1127 commented 5 months ago

Thanks, I see that this issures was solved in 3.5.1. so I'll close

guillermolc commented 1 month ago

Fixed on 4.0.0-RC1 I tested it with

kotlin = "2.0.20-RC" compose-plugin = "1.7.0-alpha02" and more..