无法使用Jetpack合成为Kotlin桌面项目创建Jar文件。
我有两个发射器:一个使用JavaFx,另一个使用Compose。使用JavaFx的运行良好。但是当我尝试执行Jar的Compose版本时-我收到错误:
P:\IntelijIDEAProjects\cliker\clicker\app\build\libs>java -jar app-1.1-COMPOSE.jar
Exception in thread "main" java.lang.ExceptionInInitializerError
at androidx.compose.ui.awt.ComposeLayer.<init>(ComposeLayer.desktop.kt:92)
at androidx.compose.ui.awt.ComposeWindowDelegate.<init>(ComposeWindowDelegate.desktop.kt:54)
at androidx.compose.ui.awt.ComposeWindow.<init>(ComposeWindow.desktop.kt:61)
at androidx.compose.ui.awt.ComposeWindow.<init>(ComposeWindow.desktop.kt:59)
at androidx.compose.ui.window.Window_desktopKt$Window$3.invoke(Window.desktop.kt:162)
at androidx.compose.ui.window.Window_desktopKt$Window$3.invoke(Window.desktop.kt:156)
at androidx.compose.ui.window.Window_desktopKt$Window$10$1.invoke(Window.desktop.kt:378)
at androidx.compose.ui.window.Window_desktopKt$Window$10$1.invoke(Window.desktop.kt:377)
at androidx.compose.ui.window.AwtWindow_desktopKt$AwtWindow$2.invoke(AwtWindow.desktop.kt:75)
at androidx.compose.ui.window.AwtWindow_desktopKt$AwtWindow$2.invoke(AwtWindow.desktop.kt:74)
at androidx.compose.runtime.DisposableEffectImpl.onRemembered(Effects.kt:81)
at androidx.compose.runtime.CompositionImpl$RememberEventDispatcher.dispatchRememberObservers(Composition.kt:1032)
at androidx.compose.runtime.CompositionImpl.applyChangesInLocked(Composition.kt:793)
at androidx.compose.runtime.CompositionImpl.applyChanges(Composition.kt:813)
at androidx.compose.runtime.Recomposer.composeInitial$runtime(Recomposer.kt:827)
at androidx.compose.runtime.CompositionImpl.setContent(Composition.kt:519)
at androidx.compose.ui.window.Application_desktopKt$awaitApplication$2$1$2.invokeSuspend(Application.desktop.kt:219)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
at java.desktop/java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:313)
at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:770)
at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:721)
at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:715)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:85)
at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:740)
at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:203)
at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:124)
at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:113)
at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:109)
at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:90)
Caused by: org.jetbrains.skiko.LibraryLoadException: Cannot find skiko-windows-x64.dll.sha256, proper native dependency missing.
at org.jetbrains.skiko.Library.findAndLoad(Library.kt:105)
at org.jetbrains.skiko.Library.load(Library.kt:59)
at org.jetbrains.skiko.SkiaLayer.<clinit>(SkiaLayer.awt.kt:28)
... 32 more
从主类运行项目运行良好。我的目标是建立这个项目的.exe文件。也许有任何其他的方法?
github上提供的项目:https://github.com/HermanAleksey/BloodWebPumper
1条答案
按热度按时间lf3rwulv1#
您收到此错误消息是因为您没有绑定本机Skiko dll。我不建议构建jar或exe。只需按照Jetbrains https://github.com/JetBrains/compose-jb/tree/master/tutorials/Native_distributions_and_local_execution中的教程为您的平台构建本机安装程序。