Describe the bug
In a Compose Multiplatform project the app crashes on startup when using version 4.0.0-RC1 for the io.insert-koin.koin-compose-viewmodel dependency.
Stacktrace:
Exception in thread "main" java.lang.UnsatisfiedLinkError: 'long org.jetbrains.skia.paragraph.TypefaceFontProviderWithFallbackKt._nMakeAsFallbackProvider()'
at org.jetbrains.skia.paragraph.TypefaceFontProviderWithFallbackKt._nMakeAsFallbackProvider(Native Method)
at org.jetbrains.skia.paragraph.TypefaceFontProviderWithFallbackKt.access$_nMakeAsFallbackProvider(TypefaceFontProviderWithFallback.kt:1)
at org.jetbrains.skia.paragraph.TypefaceFontProviderWithFallback.<init>(TypefaceFontProviderWithFallback.kt:16)
at androidx.compose.ui.text.platform.FontCache.<init>(PlatformFont.skiko.kt:201)
at androidx.compose.ui.text.platform.FontLoader.<init>(PlatformFont.skiko.kt:177)
at androidx.compose.ui.node.RootNodeOwner$OwnerImpl.<init>(RootNodeOwner.skiko.kt:331)
at androidx.compose.ui.node.RootNodeOwner.<init>(RootNodeOwner.skiko.kt:144)
at androidx.compose.ui.node.RootNodeOwner.<init>(RootNodeOwner.skiko.kt)
at androidx.compose.ui.scene.MultiLayerComposeSceneImpl.<init>(MultiLayerComposeScene.skiko.kt:112)
at androidx.compose.ui.scene.MultiLayerComposeSceneImpl.<init>(MultiLayerComposeScene.skiko.kt)
at androidx.compose.ui.scene.MultiLayerComposeScene_skikoKt.MultiLayerComposeScene-3tKcejY(MultiLayerComposeScene.skiko.kt:91)
at androidx.compose.ui.scene.MultiLayerComposeScene_skikoKt.MultiLayerComposeScene-3tKcejY$default(MultiLayerComposeScene.skiko.kt:84)
at androidx.compose.ui.scene.ComposeContainer.createComposeScene(ComposeContainer.desktop.kt:358)
at androidx.compose.ui.scene.ComposeContainer.access$createComposeScene(ComposeContainer.desktop.kt:84)
at androidx.compose.ui.scene.ComposeContainer$mediator$3.invoke(ComposeContainer.desktop.kt:142)
at androidx.compose.ui.scene.ComposeContainer$mediator$3.invoke(ComposeContainer.desktop.kt:142)
at androidx.compose.ui.scene.ComposeSceneMediator$scene$2.invoke(ComposeSceneMediator.desktop.kt:289)
at androidx.compose.ui.scene.ComposeSceneMediator$scene$2.invoke(ComposeSceneMediator.desktop.kt:289)
at kotlin.SynchronizedLazyImpl.getValue(LazyJVM.kt:74)
at androidx.compose.ui.scene.ComposeSceneMediator.getScene(ComposeSceneMediator.desktop.kt:289)
at androidx.compose.ui.scene.ComposeSceneMediator.setCompositionLocalContext(ComposeSceneMediator.desktop.kt:293)
at androidx.compose.ui.scene.ComposeContainer.setCompositionLocalContext(ComposeContainer.desktop.kt:170)
at androidx.compose.ui.awt.ComposeWindowPanel.setCompositionLocalContext(ComposeWindowPanel.desktop.kt:76)
at androidx.compose.ui.awt.ComposeWindow.setCompositionLocalContext(ComposeWindow.desktop.kt:114)
at androidx.compose.ui.window.Window_desktopKt$Window$10.invoke(Window.desktop.kt:411)
at androidx.compose.ui.window.Window_desktopKt$Window$10.invoke(Window.desktop.kt:406)
at androidx.compose.ui.window.AwtWindow_desktopKt$AwtWindow$2.invoke(AwtWindow.desktop.kt:70)
at androidx.compose.ui.window.AwtWindow_desktopKt$AwtWindow$2.invoke(AwtWindow.desktop.kt:69)
at androidx.compose.runtime.DisposableEffectImpl.onRemembered(Effects.kt:82)
at androidx.compose.runtime.CompositionImpl$RememberEventDispatcher.dispatchRememberObservers(Composition.kt:1364)
at androidx.compose.runtime.CompositionImpl.applyChangesInLocked(Composition.kt:992)
at androidx.compose.runtime.CompositionImpl.applyChanges(Composition.kt:1013)
at androidx.compose.runtime.Recomposer.composeInitial$runtime(Recomposer.kt:1142)
at androidx.compose.runtime.CompositionImpl.composeInitial(Composition.kt:649)
at androidx.compose.runtime.CompositionImpl.setContent(Composition.kt:635)
at androidx.compose.ui.window.Application_desktopKt$awaitApplication$2$1$2.invokeSuspend(Application.desktop.kt:221)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:102)
at java.desktop/java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:318)
at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:781)
at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:728)
at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:722)
at java.base/java.security.AccessController.doPrivileged(AccessController.java:400)
at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:87)
at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:750)
at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:207)
at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:128)
at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:117)
at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:113)
at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:105)
at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:92)
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':desktopApp:jvmRun'.
> Process 'command 'C:\Users\Tom\.jdks\jbr-21.0.4\bin\java.exe'' finished with non-zero exit value 1
* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
> Get more help at https://help.gradle.org.
BUILD FAILED in 7s
To Reproduce
Steps to reproduce the behavior:
Create a Compose Multiplatform Project
Add the Koin dependencies that I have defined at Koin module and version
Create a module with a Singleton and a ViewModel in which the Singleton is used in the ViewModel
3.1. I am unsure if the Singleton is required. It will probably still happen with just the ViewModel
StartKoin and create a composable that gets the ViewModel using koinViewModel
Try starting the app -> will crash
Expected behavior
The app shouldn't crash. The ViewModel should be provided. I have noticed that using 1.2.0-Beta5 as a version for the koin-compose-viewmodel dependency fixes this issue, so something broke in between those 2 versions
Koin module and version:libs.versions.toml
koin = "4.0.0-RC1"
koin-core = { group = "io.insert-koin", name = "koin-core", version.ref = "koin" }
koin-compose = { group = "io.insert-koin", name = "koin-compose", version.ref = "koin" }
koin-compose-viewmodel = { group = "io.insert-koin", name = "koin-compose-viewmodel", version.ref = "koin" }
Snippet or Sample project to help reproduce
val appModule = module {
single<MySingleton> { MySingleton() }
}
val viewModelModule = module {
viewModelOf(::MyViewModel)
}
fun initKoin(appDeclaration: KoinAppDeclaration = {}) = startKoin {
appDeclaration()
modules(appModule, viewModelModule)
}
private val koin = initKoin().koin
fun main() = application {
App()
}
@Composable
fun App() {
AppTheme {
KoinContext {
Surface {
MainScreen()
}
}
}
}
@Composable
fun MainScreen(viewModel: MyViewModel = koinViewModel()) {
Text("Bug")
}
Describe the bug In a Compose Multiplatform project the app crashes on startup when using version
4.0.0-RC1
for theio.insert-koin.koin-compose-viewmodel
dependency.Stacktrace:
To Reproduce Steps to reproduce the behavior:
koinViewModel
Expected behavior The app shouldn't crash. The ViewModel should be provided. I have noticed that using
1.2.0-Beta5
as a version for thekoin-compose-viewmodel
dependency fixes this issue, so something broke in between those 2 versionsKoin module and version:
libs.versions.toml
Snippet or Sample project to help reproduce