The Obscure “Recording currently in progress — missing #endRecording() call” Error in Compose, and How I Fixed It

Brian Terczynski
2 min readJan 13, 2024

This is just a quick note. I was working on some Jetpack Compose code recently, and I got this really bizarre error while running the code:

Recording currently in progress - missing #endRecording() call

I had no idea what this meant. I tried looking at the Compose source code, and could not make any sense of why this was happening.

I looked up a few resources online. I couldn’t find much. But after looking at this article and this one, it clued me that maybe it was an error or mistake in the code on which I was working. Like maybe some obscure crash or other behavior that Compose didn’t like.

I went through a process of elimination. I started removing various bits of my Composable. It consisted of various elements, one of them being an Image composable.

When I got around to removing the Image composable, the error went away. When I put it back, the error came back.

So it had something to do with my Image composable. But I had no idea what it could be.

Maybe it had something to do with the raster image I was using. I tried a different image. Once again the error went away.

That must have been it. This error was being caused by the raster image.

I then noticed something. The WebP I was using was HUGE. It was local resource, so it was wasn’t downloaded from the Internet or anything. Maybe Compose was barfing on the image size. As a matter of fact, the image was pretty large (about a megabyte if I remember correctly and thousands of pixels in each dimension). The image did not need to be that big; it was simply an oversight when it was added to the codebase. An image that big would get scaled down on any screen density anyways, so the size was truly excessive. I created a new version of the image that was at a more correct size. I tried it: the error went away.

So in my particular case, the above Recording currently in progress — missing #endRecording() call error was caused by an issue trying to render a huge, excessively large image.

I would imagine this kind of error could happen in a variety of cases, so if it happens to you there’s no certainty that it’s due to image size. But, I might suggest that is one thing you could look into if it does occur for you. In any case, try a process of elimination like I did to help narrow down to the Compose code that could be causing this, if this error ever happens to you.

--

--

Brian Terczynski

Documenting my learnings on my journey as a software engineer.