Mark Delphi
Mark Delphi

Reputation: 1755

androidx.compose.foundation.layout.ConsumedInsetsModifier cannot be cast to androidx.compose.ui.input.pointer.PointerInputModifier

I am facing this an issue when changing from between screen sizes (Tavle, Foldable, Phone) in the Android Emulator:

java.lang.ClassCastException: androidx.compose.foundation.layout.ConsumedInsetsModifier cannot be cast to androidx.compose.ui.input.pointer.PointerInputModifier
                                                                                at androidx.compose.ui.node.BackwardsCompatNode.onCancelPointerInput(BackwardsCompatNode.kt:354)
                                                                                at androidx.compose.ui.node.PointerInputModifierNode.onDensityChange(PointerInputModifierNode.kt:102)
                                                                                at androidx.compose.ui.node.LayoutNode.setDensity(LayoutNode.kt:669)
                                                                                at androidx.compose.ui.node.LayoutNode.setCompositionLocalMap(LayoutNode.kt:696)
                                                                                at androidx.compose.ui.node.ComposeUiNode$Companion$SetResolvedCompositionLocals$1.invoke(ComposeUiNode.kt:44)
                                                                                at androidx.compose.ui.node.ComposeUiNode$Companion$SetResolvedCompositionLocals$1.invoke(ComposeUiNode.kt:43)
                                                                                at androidx.compose.runtime.Applier.apply(Applier.kt:180)
                                                                                at androidx.compose.runtime.changelist.Operation$UpdateNode.execute(Operation.kt:554)
                                                                                at androidx.compose.runtime.changelist.Operations.executeAndFlushAllPendingOperations(Operations.kt:332)
                                                                                at androidx.compose.runtime.changelist.ChangeList.executeAndFlushAllPendingChanges(ChangeList.kt:88)
                                                                                at androidx.compose.runtime.CompositionImpl.applyChangesInLocked(Composition.kt:1033)
                                                                                at androidx.compose.runtime.CompositionImpl.applyChanges(Composition.kt:1064)
                                                                                at androidx.compose.runtime.Recomposer$runRecomposeAndApplyChanges$2$1.invoke(Recomposer.kt:669)
                                                                                at androidx.compose.runtime.Recomposer$runRecomposeAndApplyChanges$2$1.invoke(Recomposer.kt:576)
                                                                                at androidx.compose.ui.platform.AndroidUiFrameClock$withFrameNanos$2$callback$1.doFrame(AndroidUiFrameClock.android.kt:39)
                                                                                at androidx.compose.ui.platform.AndroidUiDispatcher.performFrameDispatch(AndroidUiDispatcher.android.kt:108)
                                                                                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:1404)
                                                                                at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1415)
                                                                                at android.view.Choreographer.doCallbacks(Choreographer.java:1015)
                                                                                at android.view.Choreographer.doFrame(Choreographer.java:941)
                                                                                at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:1389)
                                                                                at android.os.Handler.handleCallback(Handler.java:959)
                                                                                at android.os.Handler.dispatchMessage(Handler.java:100)
                                                                                at android.os.Looper.loopOnce(Looper.java:232)
                                                                                at android.os.Looper.loop(Looper.java:317)
                                                                                at android.app.ActivityThread.main(ActivityThread.java:8674)
                                                                                at java.lang.reflect.Method.invoke(Native Method)
                                                                                at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:580)
                                                                                at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:886)
                                                                                Suppressed: kotlinx.coroutines.internal.DiagnosticCoroutineContextException: [androidx.compose.runtime.PausableMonotonicFrameClock@8f5b374, androidx.compose.ui.platform.MotionDurationScaleImpl@d02f09d, StandaloneCoroutine{Cancelling}@5fe7912, AndroidUiDispatcher@c2938e3]

I use the Resizable API VanillaIceCreame to text on different screen sizes.

According to the error there is no issue in my code, otherwise I would see a reference to a code line in my code.

Hier is the info about Android Studio:

Android Studio Ladybug | 2024.2.1 Patch 2
Build #AI-242.23339.11.2421.12550806, built on October 24, 2024
Runtime version: 21.0.3+-79915917-b509.11 aarch64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
Toolkit: sun.lwawt.macosx.LWCToolkit
macOS 15.1
GC: G1 Young Generation, G1 Concurrent GC, G1 Old Generation
Memory: 4096M
Cores: 8
Metal Rendering is ON
Registry:
  ide.instant.shutdown=false
  debugger.new.tool.window.layout=true
  ide.experimental.ui=true
  i18n.locale=
  terminal.new.ui=true
Non-Bundled Plugins:
  com.intellij.marketplace (242.22855.133)
  dev.j-a.swift (1.1.0.354-242)
  tarn.gradle.dependencies (2.0.0)
  com.jetbrains.kmm (0.8.3(242)-5)

What is the exact issue?

In previous version of Android Studio I had not any similar issues.

Upvotes: 0

Views: 48

Answers (1)

BenjyTec
BenjyTec

Reputation: 10333

I just tested using the same setup as you:

  • Android Studio Ladybug 2024.2.1 | Patch 2
  • Resizable Emulator
  • API35 VanillaIceCream

I can't reproduce any crash using a simple demo Compose app when switching between the screen sizes. Please make sure that you have the latest emulator version installed. First, open the SDK Manager in Android Studio:

SDK Manager

Then, switch to the SDK Tools tab and locate the libraries related to the emulator:

Screenshot

If any updates are available, install them. Afterwards, delete your old Resizable emulator and create it again.


If the issue persists, try to create an empty new Compose project and run it. If you also get the issue there, then please open up an issue on the Google Issue Tracker. The Resizable emulator is still in experimental state.

Upvotes: 0

Related Questions