kosi-libs / Kodein

Painless Kotlin Dependency Injection

Home Page:https://kosi-libs.org/kodein

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

iOS targets failing to build with 'Could not find "org.kodein.type:kodein-type"'

ed-taager opened this issue · comments

Hello,

Recently, our iOS builds started failing with the following error in modules that depend on kodein-core ("org.kodein.di:kodein-di"):
Could not find "org.kodein.type:kodein-type" in [/<project_folder>, /<user_folder>/.konan/klib, /<user_folder>/.konan/kotlin-native-prebuilt-macos-aarch64-1.8.22/klib/common, /<user_folder>/.konan/kotlin-native-prebuilt-macos-aarch64-1.8.22/klib/platform/ios_simulator_arm64]

We're not entirely sure what's causing the issue but, among several changes, we recently upgraded Android Gradle Plugin to version 8. Besides that, we're using:

  • Kotlin 1.8.22
  • Kodein 7.20.2

What we tried so far:

  • Playing around with different Kotlin and Kodein versions
  • Deleting gradle and Xcode caches and re-downloading dependencies
  • Explicitly declaring the kodein dependency on affected modules
  • Explicitly declaring the kodein repo dependency on affected modules
  • Separating dependencies per target instead of having a shared commonMain dependency
  • Downgrading to AGP 7, but this one isn't possible due to other dependencies in the project

Another detail is that we're not using Cocoapods for the iOS framework but, instead, we build the XCFramework with the auto-generated gradle task ./gradlew <project>:embedAndSignAppleFrameworkForXcode

Android is still working with no issues, it's only affecting iOS.

Any clues as to what could be causing the failure?
Is there any other information we might provide to help debug the issue?

Declaring the kodein-type dependency on all failing modules did fix the issue, however this wasn't obvious at first because, on closer inspection, building would report different modules with errors every time the task ran.
Still, it warrants further debugging because, suddenly, iOS needs this dependency declared while Android does not.

You shouldn't need to add transitive dependencies, neither for iOS nor Android.
Unless you are doing some custom work with the TypeTokens?
As you are building an XCFramework, did you add your modules as export of your iOS build?