KevinnZou / compose-webview-multiplatform

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

Local html files not loading in desktop #187

Closed andreshl closed 2 months ago

andreshl commented 3 months ago

I ned load a local html file, in android it works bu in desktop i've the next error

java.lang.Object org.jetbrains.compose.resources.ResourceReader_desktopKt.readResourceBytes(java.lang.String, kotlin.coroutines.Continuation)

Exception in thread "AWT-EventQueue-0 @coroutine#2213" java.lang.NoSuchMethodError: 'java.lang.Object org.jetbrains.compose.resources.ResourceReader_desktopKt.readResourceBytes(java.lang.String, kotlin.coroutines.Continuation)' at compose_webview_multiplatform.webview.generated.resources.Res.readBytes(Res.kt:24) at com.multiplatform.webview.web.WebView_desktopKt$DesktopWebView$fileContent$2.invokeSuspend(WebView.desktop.kt:66) at com.multiplatform.webview.web.WebView_desktopKt$DesktopWebView$fileContent$2.invoke(WebView.desktop.kt) at com.multiplatform.webview.web.WebView_desktopKt$DesktopWebView$fileContent$2.invoke(WebView.desktop.kt) at androidx.compose.runtime.SnapshotStateKt__ProduceStateKt$produceState$2.invokeSuspend(ProduceState.kt:116) at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33) at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:104) at androidx.compose.ui.platform.FlushCoroutineDispatcher$dispatch$2$1.invoke(FlushCoroutineDispatcher.skiko.kt:62) at androidx.compose.ui.platform.FlushCoroutineDispatcher$dispatch$2$1.invoke(FlushCoroutineDispatcher.skiko.kt:57) at androidx.compose.ui.platform.FlushCoroutineDispatcher.performRun(FlushCoroutineDispatcher.skiko.kt:99) at androidx.compose.ui.platform.FlushCoroutineDispatcher.access$performRun(FlushCoroutineDispatcher.skiko.kt:37) at androidx.compose.ui.platform.FlushCoroutineDispatcher$dispatch$2.invokeSuspend(FlushCoroutineDispatcher.skiko.kt:57) 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@18c2cca4, androidx.compose.runtime.BroadcastFrameClock@4d6081f8, CoroutineId(2213), "coroutine#2213":StandaloneCoroutine{Cancelling}@b672aa4, FlushCoroutineDispatcher@504a69c4] Exception in thread "Thread-9" java.lang.ClassNotFoundException: org.cef.CefBrowserSettings at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:641) at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:188) at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:525) Info: (ComposeWebView) Failed to load url: ERR_FILE_NOT_FOUND file:///kcefbrowser/556144442#url=about:blank ERR_FILE_NOT_FOUND [0701/122714.586:ERROR:interface_endpoint_client.cc(707)] Message 3 rejected by interface blink.mojom.Widget

i put my file in common resources

image

KevinnZou commented 3 months ago

@andreshl What's your CMP and Kotlin version?

andreshl commented 3 months ago

@andreshl What's your CMP and Kotlin version?

Is the cmp 2.0 compose i think Is the same

KevinnZou commented 3 months ago

2.0 should be the Kotlin version. Compose Multiplatform does not have such a high version. Did you test it with the sample project?

andreshl commented 3 months ago

updating maybe the compose.components plugin has some problems compose-plugin = "1.6.11"

andreshl commented 3 months ago

yes the resource api, kotlin removes the resource method and the resources way to read is different can you helpme with that XD

here

image

KevinnZou commented 3 months ago

@andreshl Which version of this library are you using? Please upgrade to the latest version and it should work.