Hi, I'm facing an interesting issue in compose. I ...
# compose-android
s
Hi, I'm facing an interesting issue in compose. I have bunch of if checks in my code to decide which composables are shown to the user according to uiState and in debug build everything is normal and working as expected but when i create a test package with release build variant then these particular components (those im checking with if statements) causing app to crash. Is there any idea to what can cause that issue ? If i put empty composables like Spacer to the else block of that if statement then problem is gone but i dont want to do it everywhere obviously. Is there any idea to what can cause this issue ? Thanks in advance.
z
What’s the crash? It’s generally quite hard to speculate about a crash without a stack trace. Also what version of compose are you using?
👍 1
s
Sorry for the ambiguity. Here is the stacktrace: Im using compose bom version 2024.05.00
Copy code
Fatal Exception: java.lang.NullPointerException: Attempt to read from field 'androidx.compose.ui.node.LayoutNodeLayoutDelegate androidx.compose.ui.node.LayoutNode.layoutDelegate' on a null object reference in method 'void androidx.compose.ui.node.LayoutNode.onChildRemoved(androidx.compose.ui.node.LayoutNode)'
        at androidx.compose.ui.node.LayoutNode.onChildRemoved(LayoutNode.kt:363)
        at androidx.compose.ui.node.LayoutNode.removeAt$ui_release(LayoutNode.kt:340)
        at androidx.compose.ui.node.UiApplier.remove(UiApplier.android.kt:35)
        at androidx.compose.runtime.changelist.Operation$RemoveNode.execute(Operation.kt:468)
        at androidx.compose.runtime.changelist.Operations.executeAndFlushAllPendingOperations(Operations.kt:309)
        at androidx.compose.runtime.changelist.ChangeList.executeAndFlushAllPendingChanges(ChangeList.kt:81)
        at androidx.compose.runtime.CompositionImpl.applyChangesInLocked(Composition.kt:984)
        at androidx.compose.runtime.CompositionImpl.applyChanges(Composition.kt:1013)
        at androidx.compose.runtime.Recomposer$runRecomposeAndApplyChanges$2$1.invoke(Recomposer.kt:678)
        at androidx.compose.runtime.Recomposer$runRecomposeAndApplyChanges$2$1.invoke(Recomposer.kt:578)
        at androidx.compose.ui.platform.AndroidUiFrameClock$withFrameNanos$2$callback$1.doFrame(AndroidUiFrameClock.android.kt:41)
        at androidx.compose.ui.platform.AndroidUiDispatcher.performFrameDispatch(AndroidUiDispatcher.android.kt:109)
        at androidx.compose.ui.platform.AndroidUiDispatcher.access$performFrameDispatch(AndroidUiDispatcher.android.kt:41)
        at androidx.compose.ui.platform.AndroidUiDispatcher$dispatchCallback$1.doFrame(AndroidUiDispatcher.android.kt:69)
        at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1687)
        at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1698)
        at android.view.Choreographer.doCallbacks(Choreographer.java:1153)
        at android.view.Choreographer.doFrame(Choreographer.java:1069)
        at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:1646)
        at android.os.Handler.handleCallback(Handler.java:958)
        at android.os.Handler.dispatchMessage(Handler.java:99)
        at android.os.Looper.loopOnce(Looper.java:230)
        at android.os.Looper.loop(Looper.java:319)
        at android.app.ActivityThread.main(ActivityThread.java:8918)
        at java.lang.reflect.Method.invoke(Method.java)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:608)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1103)
z
Can you file a bug with a minimal project that reproduces the issue?
s
Unfortunately i couldn't reproduce it.
v
I am facing the same above issue. @Sevban Bayir have you got solution?
261 Views