Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Jetpack Compose AdapterList crashing

I am using AdapterList in Android Jetpack Compose. In list I have clickable component. When I start scrolling without untouch and go out of that AdapterList, It's crashing. It might be library issue.

Thanks in Advance.

I am using...

 //Jetpack Component

implementation 'androidx.ui:ui-framework:0.1.0-dev09'
implementation 'androidx.ui:ui-layout:0.1.0-dev09'
implementation 'androidx.ui:ui-material:0.1.0-dev09'
implementation 'androidx.ui:ui-foundation:0.1.0-dev09'
implementation 'androidx.ui:ui-tooling:0.1.0-dev09'

AdapterList

AdapterList(data = model.seats, modifier = Modifier.weight(1f).fillMaxSize()) { seat ->
                ItemSeat(seat)}

ListItem

@Composable
fun ItemSeat(seat: Seat) {
Clickable(onClick = {},
    modifier = Modifier.drawBackground(color = colorResource(id = R.color.color_cd3f34))
        .fillMaxWidth()) {
    Text(text = "Seat ${seat.no}")
 }
} 

Crash Logs

E/AndroidRuntime: FATAL EXCEPTION: main
    Process: com.nextorder.pos, PID: 4821
    java.lang.IllegalStateException: LayoutCoordinate operations are only valid when isAttached is true
        at androidx.ui.core.LayoutNodeWrapper.localToRoot(LayoutNodeWrapper.kt:169)
        at androidx.ui.core.LayoutNodeWrapper.localToGlobal(LayoutNodeWrapper.kt:165)
        at androidx.ui.core.pointerinput.PointerInputFilter.getPosition$ui_platform_release(PointerInput.kt:100)
        at androidx.ui.core.pointerinput.Node.dispatchChanges(HitPathTracker.kt:326)
        at androidx.ui.core.pointerinput.Node.dispatchChanges(HitPathTracker.kt:332)
        at androidx.ui.core.pointerinput.Node.dispatchChanges(HitPathTracker.kt:332)
        at androidx.ui.core.pointerinput.Node.dispatchChanges(HitPathTracker.kt:332)
        at androidx.ui.core.pointerinput.Node.dispatchChanges(HitPathTracker.kt:332)
        at androidx.ui.core.pointerinput.Node.dispatchChanges(HitPathTracker.kt:332)
        at androidx.ui.core.pointerinput.Node.dispatchChanges(HitPathTracker.kt:332)
        at androidx.ui.core.pointerinput.Node.dispatchChanges(HitPathTracker.kt:332)
        at androidx.ui.core.pointerinput.NodeParent.dispatchChanges(HitPathTracker.kt:194)
        at androidx.ui.core.pointerinput.HitPathTracker.dispatchChanges(HitPathTracker.kt:100)
        at androidx.ui.core.pointerinput.HitPathTracker.dispatchChanges$default(HitPathTracker.kt:91)
        at androidx.ui.core.pointerinput.PointerInputEventProcessor.process(PointerInputEventProcessor.kt:67)
        at androidx.ui.core.AndroidComposeView.onTouchEvent(AndroidOwner.kt:648)
        at android.view.View.dispatchTouchEvent(View.java:13471)
        at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3216)
        at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2888)
        at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3222)
        at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2904)
        at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3222)
        at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2904)
        at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3222)
        at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2904)
        at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3222)
        at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2904)
        at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3222)
        at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2904)
        at com.android.internal.policy.DecorView.superDispatchTouchEvent(DecorView.java:754)
        at com.android.internal.policy.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1879)
        at android.app.Activity.dispatchTouchEvent(Activity.java:3494)
        at androidx.appcompat.view.WindowCallbackWrapper.dispatchTouchEvent(WindowCallbackWrapper.java:69)
        at com.android.internal.policy.DecorView.dispatchTouchEvent(DecorView.java:712)
        at android.view.View.dispatchPointerEvent(View.java:13719)
like image 302
Madhav Gor Avatar asked Oct 16 '22 04:10

Madhav Gor


2 Answers

As of dev15 version, AdapterList has been deprecated in favor of LazyColumnFor. The issues you pointed should be fixed if you use LazyColumnFor.

like image 100
Vinay Gaba Avatar answered Oct 19 '22 03:10

Vinay Gaba


It was a known issue and has been fixed in dev14 (the current version)

like image 42
Henrique Horbovyi Avatar answered Oct 19 '22 04:10

Henrique Horbovyi