I'm working on a KMP project targeting android, ios and desktop and I'm using koin as DI, all works fine in Android and desktop(windows and macOS) but the build for iOS fails.
some of my dependencies versions:
[versions]
compose = "1.6.5"
compose-plugin = "1.6.2"
kotlin = "1.9.23"
koin = "3.6.0-alpha3"
koin-compose = "3.6.0-wasm-alpha2"
[libraries]
koin-core = { module = "io.insert-koin:koin-core", version.ref = "koin" }
koin-compose = { module = "io.insert-koin:koin-compose", version.ref = "koin-compose" }
[plugins]
jetbrainsCompose = { id = "org.jetbrains.compose", version.ref = "compose-plugin" }
my build.gradle
commonMain.dependencies {
implementation(compose.runtime)
implementation(compose.foundation)
implementation(compose.material)
implementation(compose.ui)
implementation(compose.components.resources)
implementation(compose.components.uiToolingPreview)
implementation(libs.koin.core)
implementation(libs.koin.compose)
implementation(libs.ktor.client.core)
implementation(libs.kotlinx.coroutines.core)
implementation(libs.ktor.client.content.negotiation)
implementation(libs.ktor.client.serialization.kotlinx.json)
implementation("org.jetbrains.androidx.navigation:navigation-compose:2.8.0-alpha01")
implementation(libs.coil.compose)
}
my App composable in commonMain
@Composable
@Preview
fun App() {
val navController = rememberNavController()
KoinApplication(application = {
modules(appModule())
}) {
Surface(modifier = Modifier.fillMaxSize(), color = MaterialTheme.colors.background) {
BaseNavHost(
navController = navController,
)
}
}
}
and a example of a screen(Note: the HomeViewModel is not a real one, its just a regular class)
@Composable
fun HomeScreen(
modifier: Modifier = Modifier,
homeViewModel: HomeViewModel = koinInject()
) {
//some stuffs
}
running on android and desktop works fine but for iOS fail with this error:
Task :composeApp:compileKotlinIosSimulatorArm64 FAILED
error: Could not find "org.jetbrains.compose.annotation-internal:annotation"
any idea?