Posted by David Winer, Product Supervisor
- Synthetics allow you to substitute calls to
- Parcelize lets you take away boilerplate and simply create Parcelables by means of the
Since then, we’ve got launched View Binding for Android, an formally supported library that has deep integration with the Android construct toolchain and gives comparable performance as Kotlin synthetics. Whereas we proceed to advocate Parcelize, quite a lot of drawbacks have appeared with utilizing Kotlin synthetics:
- They pollute the worldwide namespace
- They don’t expose nullability data
- They solely work in Kotlin code
JetBrains initially developed the Android Kotlin Extensions plugin, and collectively we’ve got mentioned the professionals and cons of constant to keep up synthetics: we attempt to make sure long run help for APIs the place we are able to however need to information builders in the direction of finest practices that make for wholesome codebases and, finally, completely happy customers.
Over the course of the subsequent yr, our groups will probably be collectively deprecating synthetics in favor of constant to help our advisable possibility, View Binding. Right here’s what meaning:
- If you’re utilizing Parcelize, you’ll be able to proceed to make use of the identical annotations and APIs. The annotation package deal will change to
kotlinx.parcelize, nonetheless, and In your module-level Gradle file, you must begin utilizing the standalone
kotlin-parcelizeplugin as an alternative of
android-kotlin-extensions. You’ll have the ability to discover documentation for Parcelize on the Android developer documentation site.
- If you’re utilizing Android Kotlin synthetics, you must migrate to View Binding. Take a look at our migration guide for extra particulars.
The deprecation interval begins with Kotlin 1.4.20, launched immediately.
android-kotlin-extensions will probably be eliminated in a future Kotlin launch throughout or after September 2021. Long run, we are going to proceed to keep up the
kotlin-parcelize plugin, and you may proceed to file points on Parcelize within the Android Studio issue tracker.