java.lang.IllegalArgumentException: Cannot skip th...
# compose
h
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
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
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
Fixed it by myself.
a
Hi @Hasan Nagizade, Can you explain how did you fix the issue?
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)
    }
}