KevinnZou / compose-webview-multiplatform

WebView for JetBrains Compose Multiplatform
https://kevinnzou.github.io/compose-webview-multiplatform/
Apache License 2.0
305 stars 39 forks source link

Desktop java.lang.UnsatisfiedLinkError #127

Closed cobolainen closed 1 month ago

cobolainen commented 1 month ago

i'm working on a kmm application and im using this webview compose, it runs perfectly on Android, i set the desktop app as you said but i'm getting this error. Can anyone help me and point what i am doing wrong?

i'm working with android studio on windows Log: Exception in thread "AWT-EventQueue-0" java.lang.UnsatisfiedLinkError: 'void org.cef.browser.CefMessageRouter_N.N_Initialize(org.cef.browser.CefMessageRouter$CefMessageRouterConfig)' at org.cef.browser.CefMessageRouter_N.N_Initialize(Native Method) at org.cef.browser.CefMessageRouter_N.stateHasChanged(CefMessageRouter_N.java:30) at org.cef.CefApp.onInitialization(CefApp.java:213) at org.cef.browser.CefMessageRouter_N.(CefMessageRouter_N.java:24) at org.cef.browser.CefMessageRouter.create(CefMessageRouter.java:212) at org.cef.browser.CefMessageRouter.create(CefMessageRouter.java:197) at dev.datlag.kcef.KCEFClient.(KCEFClient.kt:42) at dev.datlag.kcef.KCEF.newClientOrNull(KCEF.kt:212) at dev.datlag.kcef.KCEF$newClientOrNullBlocking$2.invokeSuspend(KCEF.kt:229) at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33) at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:104) at kotlinx.coroutines.EventLoopImplBase.processNextEvent(EventLoop.common.kt:277) at kotlinx.coroutines.BlockingCoroutine.joinBlocking(Builders.kt:95) at kotlinx.coroutines.BuildersKtBuildersKt.runBlocking(Builders.kt:69) at kotlinx.coroutines.BuildersKt.runBlocking(Unknown Source) at kotlinx.coroutines.BuildersKtBuildersKt.runBlocking$default(Builders.kt:48) at kotlinx.coroutines.BuildersKt.runBlocking$default(Unknown Source) at dev.datlag.kcef.KCEF.newClientOrNullBlocking(KCEF.kt:228) at dev.datlag.kcef.KCEF.newClientOrNullBlocking$default(KCEF.kt:228) at com.multiplatform.webview.web.WebView_desktopKt.DesktopWebView(WebView.desktop.kt:58) at com.multiplatform.webview.web.WebView_desktopKt.ActualWebView(WebView.desktop.kt:32) at com.multiplatform.webview.web.WebViewKt.WebView(WebView.kt:114) at ComposableSingletons$AppKt$lambda-1$1.invoke(App.kt:36) at ComposableSingletons$AppKt$lambda-1$1.invoke(App.kt:29) at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jb.kt:107) at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jb.kt:33) at androidx.compose.runtime.CompositionLocalKt.CompositionLocalProvider(CompositionLocal.kt:248) at androidx.compose.material.MaterialTheme_desktopKt.PlatformMaterialTheme(MaterialTheme.desktop.kt:26) at androidx.compose.material.MaterialThemeKt$MaterialTheme$1$1.invoke(MaterialTheme.kt:82) at androidx.compose.material.MaterialThemeKt$MaterialTheme$1$1.invoke(MaterialTheme.kt:81) at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jb.kt:107) at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jb.kt:33) at androidx.compose.runtime.CompositionLocalKt.CompositionLocalProvider(CompositionLocal.kt:248) at androidx.compose.material.TextKt.ProvideTextStyle(Text.kt:396) at androidx.compose.material.MaterialThemeKt$MaterialTheme$1.invoke(MaterialTheme.kt:81) at androidx.compose.material.MaterialThemeKt$MaterialTheme$1.invoke(MaterialTheme.kt:80) at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jb.kt:107) at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jb.kt:33) at androidx.compose.runtime.CompositionLocalKt.CompositionLocalProvider(CompositionLocal.kt:228) at androidx.compose.material.MaterialThemeKt.MaterialTheme(MaterialTheme.kt:72) at AppKt.App(App.kt:29) at ComposableSingletons$MainKt$lambda-1$1.invoke(main.kt:52) at ComposableSingletons$MainKt$lambda-1$1.invoke(main.kt:18) at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jb.kt:116) at androidx.compose.runtime.internal.ComposableLambdaImpl$invoke$2.invoke(ComposableLambda.jb.kt:128) at androidx.compose.runtime.internal.ComposableLambdaImpl$invoke$2.invoke(ComposableLambda.jb.kt:127) at androidx.compose.runtime.RecomposeScopeImpl.compose(RecomposeScopeImpl.kt:192) at androidx.compose.runtime.ComposerImpl.recomposeToGroupEnd(Composer.kt:2557) at androidx.compose.runtime.ComposerImpl.skipCurrentGroup(Composer.kt:2828) at androidx.compose.runtime.ComposerImpl.doCompose(Composer.kt:3315) at androidx.compose.runtime.ComposerImpl.recompose$runtime(Composer.kt:3266) at androidx.compose.runtime.CompositionImpl.recompose(Composition.kt:940) at androidx.compose.runtime.Recomposer.performRecompose(Recomposer.kt:1155) at androidx.compose.runtime.Recomposer.access$performRecompose(Recomposer.kt:127) at androidx.compose.runtime.Recomposer$runRecomposeAndApplyChanges$2$1.invoke(Recomposer.kt:583) at androidx.compose.runtime.Recomposer$runRecomposeAndApplyChanges$2$1.invoke(Recomposer.kt:551) at androidx.compose.runtime.BroadcastFrameClock$FrameAwaiter.resume(BroadcastFrameClock.kt:42) at androidx.compose.runtime.BroadcastFrameClock.sendFrame(BroadcastFrameClock.kt:71) at androidx.compose.ui.scene.BaseComposeScene.render(BaseComposeScene.skiko.kt:163) at androidx.compose.ui.scene.ComposeSceneMediator$DesktopSkikoView.onRender(ComposeSceneMediator.desktop.kt:522) at org.jetbrains.skiko.SkiaLayer.update$skiko(SkiaLayer.awt.kt:548) at org.jetbrains.skiko.redrawer.AWTRedrawer.update(AWTRedrawer.kt:54) at org.jetbrains.skiko.redrawer.Direct3DRedrawer$frameDispatcher$1.invokeSuspend(Direct3DRedrawer.kt:49) at org.jetbrains.skiko.redrawer.Direct3DRedrawer$frameDispatcher$1.invoke(Direct3DRedrawer.kt) at org.jetbrains.skiko.redrawer.Direct3DRedrawer$frameDispatcher$1.invoke(Direct3DRedrawer.kt) at org.jetbrains.skiko.FrameDispatcher$job$1.invokeSuspend(FrameDispatcher.kt:33) at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33) at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:104) at java.desktop/java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:318) at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:792) at java.desktop/java.awt.EventQueue$3.run(EventQueue.java:739) at java.desktop/java.awt.EventQueue$3.run(EventQueue.java:733) at java.base/java.security.AccessController.doPrivileged(AccessController.java:399) at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:86) at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:761) 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) Suppressed: kotlinx.coroutines.internal.DiagnosticCoroutineContextException: [androidx.compose.ui.scene.ComposeContainer$DesktopCoroutineExceptionHandler@1d6099de, androidx.compose.runtime.BroadcastFrameClock@2a75a163, StandaloneCoroutine{Cancelling}@3bdc4289, FlushCoroutineDispatcher@32a88609]

whoisjeeva commented 1 month ago

I am having the same issue when generate installer and run, when I run directly from IDE it's working fine.

KevinnZou commented 1 month ago

@whoisjeeva @cobolainen Have you followed the instructions in the ReadMe.desktop.md file and configured the Proguard rule?

cobolainen commented 1 month ago

yes have followed the instructions in readme, and i still get that error. I get he same error when i launch the sample desktopApp

whoisjeeva commented 1 month ago

I think it's an issue with the Java version mismatch, which version of jdk should I use? there was folder downloaded kcef-bundle, I deleted and replaced it with the one that downloaded when run from IDE, it is working. while I was trying to fix the issue I tried multiple jdk now even if I run it from IDE I am getting that error once the download reach 100%.

cobolainen commented 1 month ago

@whoisjeeva what is your run/debug configuration when you run from IDE? i'm trying multiple JDKs but im not getting it to work

whoisjeeva commented 1 month ago

image

image

image

I forgot which JDK I used at the first time, and it was working. Now I am trying all JDK it's giving me this error.

cobolainen commented 1 month ago

image

i get the exact same error with this settings in Android Studio:

image

image

KevinnZou commented 1 month ago

I am using Java 17. @DatL4g Could you have a look at this issue?

DatL4g commented 1 month ago

JCEF uses the JetbrainsRuntime under the hood. Any JDK prior 17 is not supported, as they are EOL. Any JDK after 17 may work but is not guaranteed. Check the Jetbrains jcef docs for more details.

JCEF is always packaged for the latest LTS release (check the JetbrainsRuntime package). Minor and bug fix version mismatch is no problem as long as the major version is the same.

You can also set the used runtime package to a specific tag in the KCEF configuration builder.

DatL4g commented 1 month ago

https://github.com/DatL4g/KCEF/issues/10#issuecomment-2020598366