java.lang.IllegalArgumentException: Cannot skip the enclosing group while in an empty region
what could be the reason of this? I literally have no idea where to look
a
Ale Stamato
09/26/2022, 10:18 AM
Where are you seeing this error? Firebase Crashlytics or how?
Version of Compose??
we’ve found this error connected to early returns (null) inside remember composable function or other composable functions
h
Hasan Nagizade
09/26/2022, 10:41 AM
It's happening to me in a KMM project. Everything was working normally until I added new composable screen to navigation and new viewmodel for it. After that everytime I am trying to run the project app crashes and gives this error. I googled with no luck
Hasan Nagizade
09/26/2022, 7:44 PM
Fixed it by myself.
a
Amardeep
12/12/2023, 8:58 AM
Hi @Hasan Nagizade, Can you explain how did you fix the issue?
Amardeep
12/12/2023, 8:59 AM
Copy code
I am getting this error when composable() throws an exception
@Composable
fun withErrorHandling(composable: @Composable () -> Unit) {
// var errorMessage by remember { mutableStateOf("") }
runCatching {
composable()
// if (errorMessage.isNotBlank()) errorScreen(errorMessage) else composable()
}.recover {
println("11111")
errorScreen(it.message.orEmpty())
}
}
@Composable
fun errorScreen(errorMessage: String) {
Row(modifier = Modifier.background(MaterialTheme.colors.background).fillMaxSize()) {
Text(errorMessage)
}
}