# dismissState crashes on Android

**URL:** <https://forums.kodeco.com/t/dismissstate-crashes-on-android/210499>\
**Category:** Kotlin Multiplatform by Tutorials\
**Created:** [March 17, 2025, 4:06pm UTC](https://forums.kodeco.com/t/dismissstate-crashes-on-android/210499 "2025-03-17T16:06:03Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![lenduya](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/lenduya/32/111174_2.png) [@lenduya](https://forums.kodeco.com/u/lenduya)\
**Post date:** [March 17, 2025, 4:06pm UTC](https://forums.kodeco.com/t/dismissstate-crashes-on-android/210499/1 "2025-03-17T16:06:03Z")

</div>

I’m at the end of chapter 5 - Compose Multiplatform.

After refactoring the code to shared-ui, the desktop app works (kinda).  
The first problem I encounter is that I cannot compile due to the file `AnimatedSwipeDismiss()`. It requires opting for experimental features, so I add:  
`@OptIn(ExperimentalMaterial3Api::class)`

This makes the code compile, however, when launching Android, adding a `TimeCard` crashes the app with the following error:

```auto
 java.lang.NoSuchMethodError: No static method rememberDismissState(Landroidx/compose/material3/DismissValue;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function2;Landroidx/compose/runtime/Composer;II)Landroidx/compose/material3/DismissState; in class Landroidx/compose/material3/SwipeToDismissKt; or its super classes (declaration of 'androidx.compose.material3.SwipeToDismissKt' appears in /data/app/~~CXsNnxDmCxnFc1b-6ysJTQ==/com.example.findtime.android-VN0wUNBrot1vExjCHt0fjw==/base.apk)

```

I didn’t make an error refactoring, the `final` version of the provided source code by the authors behaves identically - crash.

**What is the fix?**

Also I would greatly appreciate it if the Kodeco team improved their QA, how did this not get caught?

* * *

The desktop app also has a bug, most likely related to the `AnimatedSwipeDismiss`:

1. add two timezone cards
2. swipe the top timezone card to remove
3. (expected) the top timezone card disappears, the other timezone card moves up
4. (actual) both timezone cards disappear. Moving to `FindTime` and back fixes the UI and the correct timezone card appears.
5. With three items, only the item “moving up” disappears, the last item appears correctly.

---

<div class="post-metadata">

**Author:** ![kevindmoore](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/kevindmoore/32/109046_2.png) [@kevindmoore](https://forums.kodeco.com/u/kevindmoore)\
**Post date:** [March 17, 2025, 9:11pm UTC](https://forums.kodeco.com/t/dismissstate-crashes-on-android/210499/2 "2025-03-17T21:11:48Z")

</div>

Thanks so much for reaching out. It looks like the items method changed and it was not fully tested so that the key was the index instead of the timezone.  
One thing to note is that I tend to use the Canary verison of Android Studio (Meerkat) as that works better with KMP. I also tested it with AS Ladybug (stable). While you wait for the repo to be updated, here are the changes I made to fix AnimatedSwipeDismiss and TimezoneScreen:  
TimezoneScreen:  
In the LazyColumn, I changed items to:  
itemsIndexed(currentTimezoneStrings, key = { \_, timezone → timezone }) { \_, timezoneString →   
and removed  
val timezoneString = currentTimezoneStrings[index]  
For AnimatedSwipeDismiss:  
I added the following as the first line in the method:  
var isVisible by remember { mutableStateOf(true) } // Visibility state

Change the AnimatedVisibility to:  
AnimatedVisibility(  
modifier = modifier,  
visible = isVisible,  
enter = enter,  
exit = exit  
) {

I hope this helps. I tested on Mac desktop and Android and everything works fine. I did not see any crashes. I found SwipeToDismissKt in the org.jetbrains.compose.material3:material3-desktop:1.7.3 for desktop

---

<div class="post-metadata">

**Author:** ![denny64woren](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/denny64woren/32/110937_2.png) [@denny64woren](https://forums.kodeco.com/u/denny64woren)\
**Post date:** [July 14, 2025, 10:11am UTC](https://forums.kodeco.com/t/dismissstate-crashes-on-android/210499/3 "2025-07-14T10:11:55Z")

</div>

> Blockquote  
> Hope this one work for me .  
> [tellpopeyes com](https://www.tellpopeyes.it.com)
