Search code examples
android-jetpack-composekotlin-experimental

Jetpack Compose Experimental API Stability in Production mode


In Jetpack Compose, there exists various number of Experimental APIs like pullRefresh and ModalBottomSheet... Is it advisable to employ an Experimental API in a production environment, such as when publishing an app on the Google Play Store? Concerns may arise regarding the stability and longevity of these APIs. What if the library is updated or is discontinued in the future?


Solution

  • Your question is probably opinion-based, as no one will be able to give you a definitive answer or a guarantee that the code you are using is going to be stable, even when requiring @ExperimentalApi.
    I can only share my thoughts and experience.


    At the current point, basically everything in Jetpack Compose material3 libraries is marked as @ExperimentalApi. However, while these APIs might change in the future, in my experience they are stable in a sense of having no bugs when you go with a stable release.
    Check out which dependency version is considered as the latest stable in the respective dependency page.

    release table

    Also, it seems like the Jetpack Compose team is rather quickly using this annotation as sort of a safety precaution. Even components like BottomAppBar which API has been stable for a long time have an @ExperimentalApi annotation.

    So I would say, you can use it in production, but be aware that when you update the dependencies once in a while, you might have to rewrite some code.
    I recently updated a project that I wrote two years ago, and it took two hours to refactor all the changed APIs. For me, this is acceptable. Also, there were no APIs removed without a direct replacement.

    I'd suggest if you have doubt on using a specific experimental Composable, check out the Google Issue Tracker and search for that Composable. This will give you a quick hint whether there are many or severe bugs occuring with that Composable.