https://kotlinlang.org logo
#decompose
Title
# decompose
o

Olivier Patry

06/23/2023, 7:39 AM
FYI, when I use decompose
1.0.0
, it's fine, but with
2.0.0-beta-01
, I have a crash with distributable release build (fine in release build), it seems to only occur after a transition from one screen to the other.
SwingMainThreadChecker not found
`2.0.0-beta-01`: •
./gradlew :dlvr-editor:runReleaseDistributable
💥
./gradlew :dlvr-editor:runRelease
`1.0.0`: •
./gradlew :dlvr-editor:runReleaseDistributable
./gradlew :dlvr-editor:runRelease
Screenshot 2023-06-23 at 09.41.41.png
I'm running it on desktop without compose multiplatform, simple Jetbrains compose for desktop
a

Arkadii Ivanov

06/23/2023, 8:07 AM
Do you have a full stack trace?
o

Olivier Patry

06/23/2023, 9:12 PM
Sorry I missed the answer. I'll check that when I go back to work on Monday.
a

Arkadii Ivanov

06/25/2023, 1:59 PM
It appears that ProGuard removes
SwingMainThreadChecker
, the same issue usually happens with
SwingDispatcherFactory
. Try adding the following rule to your ProGuard config file:
Copy code
-keep class com.arkivanov.decompose.extensions.compose.jetbrains.mainthread.SwingMainThreadChecker
I have added this information to the docs.
o

Olivier Patry

06/26/2023, 7:20 AM
I do not use ProGuard (AFAIK)
Copy code
Exception in thread "AWT-EventQueue-0" java.util.ServiceConfigurationError: com.arkivanov.decompose.mainthread.MainThreadChecker: Provider com.arkivanov.decompose.extensions.compose.jetbrains.mainthread.SwingMainThreadChecker not found
        at java.base/java.util.ServiceLoader.fail(Unknown Source)
        at java.base/java.util.ServiceLoader$LazyClassPathLookupIterator.nextProviderClass(Unknown Source)
        at java.base/java.util.ServiceLoader$LazyClassPathLookupIterator.hasNextService(Unknown Source)
        at java.base/java.util.ServiceLoader$LazyClassPathLookupIterator.hasNext(Unknown Source)
        at java.base/java.util.ServiceLoader$2.hasNext(Unknown Source)
        at java.base/java.util.ServiceLoader$3.hasNext(Unknown Source)
        at kotlin.collections.CollectionsKt___CollectionsKt.firstOrNull(_Collections.kt:270)
        at com.arkivanov.decompose.mainthread.MainThreadCheckerProviderKt$mainThreadChecker$2.invoke(MainThreadCheckerProvider.kt:1006)
        at kotlin.SynchronizedLazyImpl.getValue(LazyJVM.kt:74)
        at com.arkivanov.decompose.mainthread.MainThreadCheckerProviderKt.getMainThreadChecker(MainThreadCheckerProvider.kt:5)
        at com.arkivanov.decompose.Relay.accept(Relay.kt:2006)
        at com.arkivanov.decompose.router.stack.DefaultStackNavigation.navigate(DefaultStackNavigation.kt:11)
        at com.arkivanov.decompose.router.stack.StackNavigatorExtKt.push$default$42c8ac6c(StackNavigatorExt.kt:1016)
        at org.acme.tool.dlvr.ui.ProductDeliveryEditorKt$ProductDeliveryEditor$1$1$1$2$2.invoke(ProductDeliveryEditor.kt:1094)
        at org.acme.tool.dlvr.ui.screen.ProjectChoiceScreenKt$ChooseProjectScreen$1$1.invokeSuspend(projectChoiceScreen.kt:91)
        at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
        at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
        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:91)
        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:106)
        at java.desktop/java.awt.event.InvocationEvent.dispatch(Unknown Source)
        at java.desktop/java.awt.EventQueue.dispatchEventImpl(Unknown Source)
        at java.desktop/java.awt.EventQueue$4.run(Unknown Source)
        at java.desktop/java.awt.EventQueue$4.run(Unknown Source)
        at java.base/java.security.AccessController.doPrivileged(Unknown Source)
        at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
        at java.desktop/java.awt.EventQueue.dispatchEvent(Unknown Source)
        at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
        at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
        at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
        at java.desktop/java.awt.EventDispatchThread.pumpEvents(Unknown Source)
        at java.desktop/java.awt.EventDispatchThread.pumpEvents(Unknown Source)
        at java.desktop/java.awt.EventDispatchThread.run(Unknown Source)
        Suppressed: kotlinx.coroutines.internal.DiagnosticCoroutineContextException: [androidx.compose.ui.awt.ComposeLayer$coroutineExceptionHandler$1@58893166, androidx.compose.runtime.BroadcastFrameClock@3069faa0, StandaloneCoroutine{Cancelling}@3afc866e, FlushCoroutineDispatcher@1d6f0299]
a

Arkadii Ivanov

06/26/2023, 8:14 AM
I believe ProGuard is used by default. https://github.com/JetBrains/compose-multiplatform/tree/master/tutorials/Native_distributions_and_local_execution#minification--obfuscation Could you please try the fix I mentioned above and check if it helps?
o

Olivier Patry

06/26/2023, 9:25 AM
Monday morning… need some coffee apparently 😅 So, good news, you were right, ProGuard issue and fixed by your suggestion, all good 👍
thanks for the support 🙇
a

Arkadii Ivanov

06/26/2023, 9:27 AM
You are welcome! And thanks for reporting the issue.
3 Views