https://kotlinlang.org logo
#compose-wear
Title
# compose-wear
f

florent

01/23/2023, 11:42 PM
Good evening, do you know how to use derivedState on release build? I got that crash every time I tried
androidx.compose.runtime.ComposeRuntimeError: Compose Runtime internal error. Unexpected or incorrect use of the Compose internal runtime API (Missed recording an endGroup). Please report to Google or use https://goo.gle/compose-feedback at androidx.tracing.Trace.composeRuntimeError(Unknown Source:15) at androidx.compose.runtime.ComposerImpl.end(Unknown Source:991) at androidx.compose.runtime.ComposerImpl.endRestartGroup(Unknown Source:159) at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(SourceFile:22) at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(SourceFile:11) at kotlin.ResultKt.Button(Unknown Source:661) at androidx.wear.compose.material.ButtonKt$Button$5.invoke(Unknown Source:34) at androidx.compose.runtime.ComposerImpl.recomposeToGroupEnd(Unknown Source:285) at androidx.compose.runtime.ComposerImpl.skipToGroupEnd(Unknown Source:33) at androidx.compose.ui.graphics.vector.VectorPainter$composeVector$1.invoke(SourceFile:53) at androidx.compose.ui.graphics.vector.VectorPainter$composeVector$1.invoke(SourceFile:151) at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(SourceFile:8) at androidx.compose.ui.graphics.vector.VectorPainter$composeVector$1.invoke(SourceFile:9) at androidx.compose.ui.graphics.vector.VectorPainter$composeVector$1.invoke(SourceFile:124) at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(SourceFile:8) at androidx.compose.runtime.Updater.invokeComposable(Unknown Source:19) at okhttp3.CertificatePinner$check$1.invoke(SourceFile:62) at okhttp3.CertificatePinner$check$1.invoke(SourceFile:115) at androidx.compose.runtime.Updater.observeDerivedStateRecalculations(Unknown Source:42) at androidx.compose.runtime.ComposerImpl.doCompose(Unknown Source:124) at androidx.compose.runtime.ComposerImpl.composeContent$runtime_release(Unknown Source:13) at androidx.compose.runtime.CompositionImpl.composeContent(Unknown Source:18) at androidx.compose.runtime.Recomposer.composeInitial$runtime_release(Unknown Source:54) at androidx.compose.runtime.ComposerImpl$CompositionContextImpl.composeInitial$runtime_release(Unknown Source:9) at androidx.compose.runtime.CompositionImpl.setContent(Unknown Source:10) at androidx.compose.ui.layout.LayoutNodeSubcompositionsState.subcompose(Unknown Source:106) at androidx.compose.ui.layout.LayoutNodeSubcompositionsState$Scope.subcompose(Unknown Source:124) at androidx.compose.foundation.lazy.LazyMeasuredItemProvider.getAndMeasure-ZjPyQlc(Unknown Source:49) at androidx.compose.foundation.lazy.LazyListKt$rememberLazyListMeasurePolicy$1$1.invoke(Unknown Source:696) at androidx.compose.ui.graphics.vector.VectorPainter$composeVector$1.invoke(SourceFile:150) at androidx.compose.ui.layout.LayoutNodeSubcompositionsState$createMeasurePolicy$1.measure-3p2s80s(Unknown Source:47) at androidx.compose.ui.node.InnerNodeCoordinator.measure-BRTryo0(Unknown Source:36) at androidx.compose.ui.graphics.SimpleGraphicsLayerModifier.measure-3p2s80s(Unknown Source:5) at androidx.compose.ui.node.LayoutModifierNodeCoordinator.measure-BRTryo0(Unknown Source:24) at androidx.compose.foundation.layout.FillModifier.measure-3p2s80s(Unknown Source:95) at androidx.compose.ui.node.LayoutModifierNodeCoordinator.measure-BRTryo0(Unknown Source:24) at androidx.compose.foundation.layout.SizeModifier.measure-3p2s80s(Unknown Source:121) at androidx.compose.ui.node.LayoutModifierNodeCoordinator.measure-BRTryo0(Unknown Source:24) at androidx.compose.ui.node.LayoutNodeLayoutDelegate$performMeasure$2.invoke(SourceFile:8) at androidx.compose.ui.node.LayoutNodeLayoutDelegate$performMeasure$2.invoke(SourceFile:2) at androidx.compose.ui.unit.Dp$Companion.observe(Unknown Source:63) at androidx.compose.ui.node.NodeCoordinator$invoke$1.invoke(SourceFile:75) at androidx.compose.ui.node.NodeCoordinator$invoke$1.invoke(SourceFile:21) at androidx.compose.runtime.Updater.observeDerivedStateRecalculations(Unknown Source:42) at androidx.compose.ui.node.OwnerSnapshotObserver.observeReads$ui_release(Unknown Source:117) at androidx.compose.ui.node.LayoutNodeLayoutDelegate$MeasurePassDelegate.remeasure-BRTryo0(Unknown Source:115) at androidx.compose.ui.node.LayoutNode.remeasure-_Sx5XlM$ui_release(Unknown Source:16) at androidx.compose.ui.node.MeasureAndLayoutDelegate.doRemeasure-sdFAvZA(Unknown Source:24) at androidx.compose.ui.node.MeasureAndLayoutDelegate.remeasureAndRelayoutIfNeeded(Unknown Source:124) at androidx.compose.ui.node.MeasureAndLayoutDelegate.measureAndLayout(Unknown Source:70) at androidx.compose.ui.platform.AndroidComposeView.measureAndLayout(Unknown Source:13) at androidx.compose.ui.node.Owner.measureAndLayout$default(Unknown Source:3) at androidx.compose.ui.platform.AndroidComposeView.dispatchDraw(Unknown Source:18) at android.view.View.draw(View.java:22384) at android.view.View.updateDisplayListIfDirty(View.java:21257) at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:4504) at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:4477) at android.view.View.updateDisplayListIfDirty(View.java:21217) at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:4504) at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:4477) at android.view.View.updateDisplayListIfDirty(View.java:21217) at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:4504) at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:4477) at android.view.View.updateDisplayListIfDirty(View.java:21217) at android.view.ThreadedRenderer.updateViewTreeDisplayList(ThreadedRenderer.java:559) at android.view.ThreadedRenderer.updateRootDisplayList(ThreadedRenderer.java:565) at android.view.ThreadedRenderer.draw(ThreadedRenderer.java:642) at android.view.ViewRootImpl.draw(ViewRootImpl.java:4117) at android.view.ViewRootImpl.performDraw(ViewRootImpl.java:3844) at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:3115) at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1968) at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:8199) at android.view.Choreographer$CallbackRecord.run(Choreographer.java:972) at android.view.Choreographer.doCallbacks(Choreographer.java:796) at android.view.Choreographer.doFrame(Choreographer.java:731) at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:957) at android.os.Handler.handleCallback(Handler.java:938) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loop(Looper.java:223) at android.app.ActivityThread.main(ActivityThread.java:7651) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)
I am using the latest version on everything for compose 1.4.0-alpha04. It is working ok on debug build but it crashes right away on prod build when the derivedState is changed
now I am going to bed, Flo out
j

John Nichol

01/24/2023, 7:45 AM
We use derivedStateOf in several places in the Compose for Wear OS library in release builds without problems - appreciate that doesn't help with your current issue, but at least tells you that the approach itself generally works without issue
Is 1.4.0-alpha03 working ok in release build?
Looks like there are a few bug reports - https://issuetracker.google.com/issues?q=%22Unexpected%20or%20incorrect%20use%20of%20the[…]20runtime%20API%20(Missed%20recording%20an%20endGroup)%22 - I will take a look when back at work laptop to see if I can find any additonal leads - but I think a small repro case is going to be the best way forward
f

florent

01/24/2023, 10:39 AM
do you know why this is part of the stacktrace? at okhttp3.CertificatePinner$check$1.invoke(SourceFile:62) at okhttp3.CertificatePinner$check$1.invoke(SourceFile:115)
I have found the issue it is on the button, turn out you can't dynamically change the enabled property
It works in debug, crashes in release when you scroll
y

yschimke

01/24/2023, 12:34 PM
okhttp3.CertificatePinner must be a deobfuscation bug. CertificatePinner.check can't make those calls.
m

Michail Kulaga

01/24/2023, 12:35 PM
Hi Florent. Thanks for raising this issue! I was able to reproduce this crash. It probably has nothing to do with derivedStateOf, but rather something else in compose. It was sent to Jetpack Compose team for further investigation https://issuetracker.google.com/266548542
y

yschimke

01/24/2023, 12:37 PM
Another report of that specific error without wear compose https://b.corp.google.com/issues/265962213
m

Michail Kulaga

01/24/2023, 12:38 PM
f

florent

01/24/2023, 1:07 PM
@Michail Kulaga I don't have the same crash that you have reported on my sample project: Process: com.example.derivedstatecrash, PID: 10960 java.lang.ClassCastException: androidx.compose.ui.focus.FocusChangedModifierNode cannot be cast to androidx.compose.ui.focus.FocusPropertiesModifierNodeImpl at androidx.compose.ui.focus.FocusPropertiesKt$focusProperties$$inlined$modifierElementOf$2.update(Unknown Source:52) at androidx.compose.ui.node.NodeChain.updateNodeAndReplaceIfNeeded(Unknown Source:20) at androidx.compose.ui.node.LayoutNode.setModifier(Unknown Source:1235) at androidx.compose.ui.CombinedModifier$toString$1.invoke(SourceFile:26) at androidx.compose.runtime.CompositionImpl.applyChangesInLocked(Unknown Source:59) at androidx.compose.runtime.CompositionImpl.applyChanges(Unknown Source:5) at androidx.compose.runtime.ComposerImpl$apply$operation$1.invoke(Unknown Source:35) at androidx.compose.runtime.Recomposer$runRecomposeAndApplyChanges$2$2.invoke(Unknown Source:169) at androidx.compose.ui.platform.AndroidUiFrameClock$withFrameNanos$2$callback$1.doFrame(Unknown Source:6) at androidx.compose.ui.platform.AndroidUiDispatcher$dispatchCallback$1.doFrame(Unknown Source:47) at android.view.Choreographer$CallbackRecord.run(Choreographer.java:970) at android.view.Choreographer.doCallbacks(Choreographer.java:796) at android.view.Choreographer.doFrame(Choreographer.java:727) at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:957) at android.os.Handler.handleCallback(Handler.java:938) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loop(Looper.java:223) at android.app.ActivityThread.main(ActivityThread.java:7651) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947) Suppressed: kotlinx.coroutines.DiagnosticCoroutineContextException: [androidx.compose.runtime.PausableMonotonicFrameClock@925ffbf, androidx.compose.ui.platform.MotionDurationScaleImpl@5d4468c, StandaloneCoroutine{Cancelling}@528e1d5, AndroidUiDispatcher@6f53dea]
and that one I also got in my current project and it was quick to fix, I was doing a
Modifier.focusable(value)
I changed to only
Modifier.focusable()
and it fixed that bug
s

shikasd

01/24/2023, 4:32 PM
The focus modifier issue is already fixed in main, should be part of the next beta You can downgrade to 1.3 or try latest patches from master to get it in your project.
129 Views