JetBrains / compose-multiplatform

Compose Multiplatform, a modern UI framework for Kotlin that makes building performant and beautiful user interfaces easy and enjoyable.
https://jetbrains.com/lp/compose-multiplatform
Apache License 2.0
15.96k stars 1.16k forks source link

java.lang.VerifyError: Bad type on operand stack #3947

Open SudoDios opened 10 months ago

SudoDios commented 10 months ago

Describe the bug Hi. When i enable proguard, I get the error where the textfield is.

Affected platforms Select one of the platforms below:

If the bug is Android-only, report it in the Jetpack Compose tracker

Versions

full log

Exception in thread "AWT-EventQueue-0" java.lang.VerifyError: Bad type on operand stack
Exception Details:
  Location:
    b/b/f/p/e/z.a()[I @3: invokevirtual
  Reason:
    Type '[I' (current frame, stack[0]) is not assignable to '[Ljava/lang/Object;'
  Current Frame:
    bci: @3
    flags: { }
    locals: { }
    stack: { '[I' }
  Bytecode:
    0000000: b200 0db6 000e c000 01b0
.....
at org.jetbrains.skiko.SkiaLayer.update$skiko(Unknown Source)
    at org.jetbrains.skiko.redrawer.AWTRedrawer.update(Unknown Source)
    at org.jetbrains.skiko.redrawer.LinuxOpenGLRedrawer$Companion$frameDispatcher$1.invokeSuspend(Unknown Source)
    at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(Unknown Source)
    at kotlinx.coroutines.DispatchedTask.run(Unknown Source)
    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)

How to fix it ?

SudoDios commented 10 months ago

This is probably the problem of the font. Because when I manually set the font, the problem is solved.

at androidx.compose.ui.text.platform.DesktopFont_desktopKt.currentPlatform$2a139b4b(DesktopFont.desktop.kt:182)
    at androidx.compose.ui.text.platform.PlatformFont_skikoKt$GenericFontFamiliesMapping$2.invoke(PlatformFont.skiko.kt:1218)
    at kotlin.SynchronizedLazyImpl.getValue(LazyJVM.kt:74)
    at androidx.compose.ui.text.platform.PlatformFont_skikoKt.getGenericFontFamiliesMapping(PlatformFont.skiko.kt:217)
acarlsen commented 9 months ago

I have a similar issue on OSX when building release with proguard as well.

Affected platforms

Versions

Log

Exception in thread "main" java.lang.VerifyError: Bad type on operand stack
Exception Details:
  Location:
    androidx/compose/ui/text/platform/Platform.values$72072044()[I @3: invokevirtual
  Reason:
    Type '[I' (current frame, stack[0]) is not assignable to '[Ljava/lang/Object;'
  Current Frame:
    bci: @3
    flags: { }
    locals: { }
    stack: { '[I' }
  Bytecode:
    0000000: b200 09b6 0012 c000 05b0               

        at androidx.compose.ui.text.platform.DesktopFont_desktopKt.currentPlatform$2a139b4b(DesktopFont.desktop.kt:184)
        at androidx.compose.ui.text.platform.PlatformFont_skikoKt$GenericFontFamiliesMapping$2.invoke(PlatformFont.skiko.kt:1218)
        at kotlin.SynchronizedLazyImpl.getValue(LazyJVM.kt:74)
        at androidx.compose.ui.text.platform.PlatformFont_skikoKt.getGenericFontFamiliesMapping(PlatformFont.skiko.kt:217)
        at androidx.compose.ui.text.platform.FontCache.mapGenericFontFamily(PlatformFont.skiko.kt:154)
        at androidx.compose.ui.text.font.FontFamilyResolverImpl$resolve$result$1.invoke(FontFamilyResolver.kt:16198)
        at androidx.compose.ui.text.font.TypefaceRequestCache.runCached(FontFamilyResolver.kt:185)
        at androidx.compose.ui.text.font.FontFamilyResolverImpl.resolve(FontFamilyResolver.kt:92)
        at androidx.compose.ui.text.font.FontFamilyResolverImpl.resolve-DPcqOEQ(FontFamilyResolver.kt:79)
        at androidx.compose.ui.text.platform.ParagraphBuilder$makeSkTextStyle$1.invoke(SkiaParagraph.skiko.kt:17227)
        at androidx.compose.ui.text.WeakKeysCache.get(Cache.jvm.kt:24)
        at androidx.compose.ui.text.platform.ParagraphBuilder.makeSkTextStyle(SkiaParagraph.skiko.kt:547)
        at androidx.compose.ui.text.platform.ParagraphBuilder.build(SkiaParagraph.skiko.kt:14513)
        at androidx.compose.ui.text.platform.ParagraphLayouter.layoutParagraph(ParagraphLayouter.skiko.kt:162)
        at androidx.compose.ui.text.platform.SkiaParagraphIntrinsics.<init>(SkiaParagraphIntrinsics.skiko.kt:80)
        at androidx.compose.ui.text.platform.SkiaParagraphIntrinsics_skikoKt.ActualParagraphIntrinsics(SkiaParagraphIntrinsics.skiko.kt:37)
        at androidx.compose.ui.text.ParagraphIntrinsicsKt.ParagraphIntrinsics(ParagraphIntrinsics.kt:98)
        at androidx.compose.ui.text.MultiParagraphIntrinsics.<init>(MultiParagraphIntrinsics.kt:102)
        at androidx.compose.foundation.text.modifiers.MultiParagraphLayoutCache.setLayoutDirection(MultiParagraphLayoutCache.kt:250)
        at androidx.compose.foundation.text.modifiers.MultiParagraphLayoutCache.layoutText-K40F9xA(MultiParagraphLayoutCache.kt:275)
        at androidx.compose.foundation.text.modifiers.MultiParagraphLayoutCache.layoutWithConstraints-K40F9xA(MultiParagraphLayoutCache.kt:162)
        at androidx.compose.foundation.text.modifiers.TextAnnotatedStringNode.measure-3p2s80s(TextAnnotatedStringNode.kt:270)
        at androidx.compose.ui.node.LayoutModifierNodeCoordinator.measure-BRTryo0(LayoutModifierNodeCoordinator.kt:116)
        at androidx.compose.ui.graphics.SimpleGraphicsLayerModifier.measure-3p2s80s(GraphicsLayerModifier.kt:646)
        at androidx.compose.ui.node.LayoutModifierNodeCoordinator.measure-BRTryo0(LayoutModifierNodeCoordinator.kt:116)
        at androidx.compose.ui.node.LayoutNodeLayoutDelegate$performMeasure$2.invoke(LayoutNodeLayoutDelegate.kt:2499)
        at androidx.compose.runtime.snapshots.Snapshot$Companion.observe(Snapshot.kt:2300)
        at androidx.compose.runtime.snapshots.SnapshotStateObserver.observeReads(SnapshotStateObserver.kt:21471)
        at androidx.compose.ui.node.OwnerSnapshotObserver.observeReads$ui(OwnerSnapshotObserver.kt:133)
        at androidx.compose.ui.node.OwnerSnapshotObserver.observeMeasureSnapshotReads$ui(OwnerSnapshotObserver.kt:113)
        at androidx.compose.ui.node.LayoutNodeLayoutDelegate.access$performMeasure-BRTryo0(LayoutNodeLayoutDelegate.kt:7495)
        at androidx.compose.ui.node.LayoutNodeLayoutDelegate$MeasurePassDelegate.remeasure-BRTryo0(LayoutNodeLayoutDelegate.kt:560)
        at androidx.compose.ui.node.LayoutNodeLayoutDelegate$MeasurePassDelegate.measure-BRTryo0(LayoutNodeLayoutDelegate.kt:539)
        at androidx.compose.foundation.layout.BoxKt$boxMeasurePolicy$1.measure-3p2s80s(Box.kt:114)
        at androidx.compose.ui.node.InnerNodeCoordinator.measure-BRTryo0(InnerNodeCoordinator.kt:126)
        at androidx.compose.foundation.layout.FillNode.measure-3p2s80s(Size.kt:698)
        at androidx.compose.ui.node.LayoutModifierNodeCoordinator.measure-BRTryo0(LayoutModifierNodeCoordinator.kt:116)
        at androidx.compose.ui.node.LayoutNodeLayoutDelegate$performMeasure$2.invoke(LayoutNodeLayoutDelegate.kt:2499)
        at androidx.compose.runtime.snapshots.Snapshot$Companion.observe(Snapshot.kt:2300)
        at androidx.compose.runtime.snapshots.SnapshotStateObserver.observeReads(SnapshotStateObserver.kt:21471)
        at androidx.compose.ui.node.OwnerSnapshotObserver.observeReads$ui(OwnerSnapshotObserver.kt:133)
        at androidx.compose.ui.node.OwnerSnapshotObserver.observeMeasureSnapshotReads$ui(OwnerSnapshotObserver.kt:113)
        at androidx.compose.ui.node.LayoutNodeLayoutDelegate.access$performMeasure-BRTryo0(LayoutNodeLayoutDelegate.kt:7495)
        at androidx.compose.ui.node.LayoutNodeLayoutDelegate$MeasurePassDelegate.remeasure-BRTryo0(LayoutNodeLayoutDelegate.kt:560)
        at androidx.compose.ui.node.LayoutNodeLayoutDelegate$MeasurePassDelegate.measure-BRTryo0(LayoutNodeLayoutDelegate.kt:539)
        at androidx.compose.ui.awt.ComposeWindowDelegate$WindowContentLayout$2.measure-3p2s80s(ComposeWindowDelegate.desktop.kt:195)
        at androidx.compose.ui.node.InnerNodeCoordinator.measure-BRTryo0(InnerNodeCoordinator.kt:126)
        at androidx.compose.ui.node.LayoutNodeLayoutDelegate$performMeasure$2.invoke(LayoutNodeLayoutDelegate.kt:2499)
        at androidx.compose.runtime.snapshots.Snapshot$Companion.observe(Snapshot.kt:2300)
        at androidx.compose.runtime.snapshots.SnapshotStateObserver.observeReads(SnapshotStateObserver.kt:21471)
        at androidx.compose.ui.node.OwnerSnapshotObserver.observeReads$ui(OwnerSnapshotObserver.kt:133)
        at androidx.compose.ui.node.OwnerSnapshotObserver.observeMeasureSnapshotReads$ui(OwnerSnapshotObserver.kt:113)
        at androidx.compose.ui.node.LayoutNodeLayoutDelegate.access$performMeasure-BRTryo0(LayoutNodeLayoutDelegate.kt:7495)
        at androidx.compose.ui.node.LayoutNodeLayoutDelegate$MeasurePassDelegate.remeasure-BRTryo0(LayoutNodeLayoutDelegate.kt:560)
        at androidx.compose.ui.node.LayoutNodeLayoutDelegate$MeasurePassDelegate.measure-BRTryo0(LayoutNodeLayoutDelegate.kt:539)
        at androidx.compose.ui.layout.RootMeasurePolicy.measure-3p2s80s(RootMeasurePolicy.kt:38)
        at androidx.compose.ui.node.InnerNodeCoordinator.measure-BRTryo0(InnerNodeCoordinator.kt:126)
        at androidx.compose.ui.node.LayoutNodeLayoutDelegate$performMeasure$2.invoke(LayoutNodeLayoutDelegate.kt:2499)
        at androidx.compose.runtime.snapshots.Snapshot$Companion.observe(Snapshot.kt:2300)
        at androidx.compose.runtime.snapshots.SnapshotStateObserver.observeReads(SnapshotStateObserver.kt:21471)
        at androidx.compose.ui.node.OwnerSnapshotObserver.observeReads$ui(OwnerSnapshotObserver.kt:133)
        at androidx.compose.ui.node.OwnerSnapshotObserver.observeMeasureSnapshotReads$ui(OwnerSnapshotObserver.kt:113)
        at androidx.compose.ui.node.LayoutNodeLayoutDelegate.access$performMeasure-BRTryo0(LayoutNodeLayoutDelegate.kt:7495)
        at androidx.compose.ui.node.LayoutNodeLayoutDelegate$MeasurePassDelegate.remeasure-BRTryo0(LayoutNodeLayoutDelegate.kt:560)
        at androidx.compose.ui.node.LayoutNode.remeasure-_Sx5XlM$ui(LayoutNode.kt:53411)
        at androidx.compose.ui.node.MeasureAndLayoutDelegate.doRemeasure-sdFAvZA(MeasureAndLayoutDelegate.kt:321)
        at androidx.compose.ui.node.MeasureAndLayoutDelegate.remeasureAndRelayoutIfNeeded(MeasureAndLayoutDelegate.kt:458)
        at androidx.compose.ui.node.MeasureAndLayoutDelegate.measureAndLayout(MeasureAndLayoutDelegate.kt:12039)
        at androidx.compose.ui.platform.SkiaBasedOwner.measureAndLayout(SkiaBasedOwner.skiko.kt:246)
        at androidx.compose.ui.node.Owner.measureAndLayout$default(Owner.kt:223)
        at androidx.compose.ui.awt.ComposeBridge$skikoView$1$onRender$1.invoke(ComposeBridge.desktop.kt:2546)
        at androidx.compose.ui.awt.ComposeBridge.catchExceptions(ComposeBridge.desktop.kt:150)
        at androidx.compose.ui.awt.ComposeBridge$skikoView$1.onRender(ComposeBridge.desktop.kt:1064)
        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.MetalRedrawer.redrawImmediately(MetalRedrawer.kt:113)
        at org.jetbrains.skiko.SkiaLayer.paint(SkiaLayer.awt.kt:388)
        at androidx.compose.ui.awt.WindowComposeBridge$component$1.paint(WindowComposeBridge.desktop.kt:62)
        at java.desktop/javax.swing.JComponent.paintChildren(Unknown Source)
        at java.desktop/javax.swing.JComponent.paint(Unknown Source)
        at java.desktop/javax.swing.JLayeredPane.paint(Unknown Source)
        at java.desktop/javax.swing.JComponent.paintChildren(Unknown Source)
        at java.desktop/javax.swing.JComponent.paint(Unknown Source)
        at androidx.compose.ui.window.Window_desktopKt$Window$12$1.invoke(Window.desktop.kt:1433)
        at androidx.compose.ui.window.AwtWindow_desktopKt$AwtWindow$3.invoke(AwtWindow.desktop.kt:1078)
        at androidx.compose.ui.util.UpdateEffect_desktopKt$UpdateEffect$2$performUpdate$1.invoke(UpdateEffect.desktop.kt:1059)
        at androidx.compose.runtime.snapshots.Snapshot$Companion.observe(Snapshot.kt:2300)
        at androidx.compose.runtime.snapshots.SnapshotStateObserver.observeReads(SnapshotStateObserver.kt:21471)
        at androidx.compose.ui.util.UpdateEffect_desktopKt$UpdateEffect$2.invoke$performUpdate(UpdateEffect.desktop.kt:55)
        at androidx.compose.ui.util.UpdateEffect_desktopKt$UpdateEffect$2.invoke(UpdateEffect.desktop.kt:1064)
        at androidx.compose.runtime.DisposableEffectImpl.onRemembered(Effects.kt:81)
        at androidx.compose.runtime.CompositionImpl$RememberEventDispatcher.dispatchRememberObservers(Composition.kt:1137)
        at androidx.compose.runtime.CompositionImpl.applyChangesInLocked(Composition.kt:828)
        at androidx.compose.runtime.CompositionImpl.applyChanges(Composition.kt:849)
        at androidx.compose.runtime.Recomposer.composeInitial$runtime(Recomposer.kt:1041)
        at androidx.compose.runtime.CompositionImpl.setContent(Composition.kt:520)
        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:108)
        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)
acarlsen commented 9 months ago

It works for me if I add the following to proguard config file:

-keep class androidx.compose.** { *; }

But I guess that shouldn't be needed.

okushnikov commented 3 weeks ago

Please check the following ticket on YouTrack for follow-ups to this issue. GitHub issues will be closed in the coming weeks.