# A study of the Parcelize feature from Kotlin Android Extensions

DevFeed: [A study of the Parcelize feature from Kotlin Android Extensions](<https://devfeed.tech/articles/a-study-of-the-parcelize-feature-from-kotlin-android-extensions-25876.md>)

Original publisher: [Read original article](<https://bladecoder.medium.com/a-study-of-the-parcelize-feature-from-kotlin-android-extensions-59a5adcd5909?source=rss-54910f05af37------2>)

Author: Christophe Beyls

Published: 2019-11-19T07:31:01Z

Content type: tutorial

Language: en

Sources: [Stories by Christophe Beyls on Medium](<https://devfeed.tech/sources/stories-by-christophe-beyls-on-medium.md>)

Topics: [Kotlin](<https://devfeed.tech/topics/kotlin.md>), [Android](<https://devfeed.tech/topics/android.md>), [Code generation](<https://devfeed.tech/topics/code-generation.md>), [Gradle](<https://devfeed.tech/topics/gradle.md>), [Android Studio](<https://devfeed.tech/topics/android-studio.md>), [jetbrains](<https://devfeed.tech/topics/jetbrains.md>), [Google](<https://devfeed.tech/topics/google.md>)

Tags: [android](<https://devfeed.tech/tags/android.md>), [android-app-development](<https://devfeed.tech/tags/android-app-development.md>), [android-studio](<https://devfeed.tech/tags/android-studio.md>), [androiddev](<https://devfeed.tech/tags/androiddev.md>), [code-generation](<https://devfeed.tech/tags/code-generation.md>), [google](<https://devfeed.tech/tags/google.md>), [gradle](<https://devfeed.tech/tags/gradle.md>), [gradle-plugin](<https://devfeed.tech/tags/gradle-plugin.md>), [jetbrains](<https://devfeed.tech/tags/jetbrains.md>), [kotlin](<https://devfeed.tech/tags/kotlin.md>), [kotlin-android](<https://devfeed.tech/tags/kotlin-android.md>), [kotlin-android-extensions](<https://devfeed.tech/tags/kotlin-android-extensions.md>), [parcelable](<https://devfeed.tech/tags/parcelable.md>), [parcelize](<https://devfeed.tech/tags/parcelize.md>), [plugin](<https://devfeed.tech/tags/plugin.md>), [production](<https://devfeed.tech/tags/production.md>)

## AI overview

This article examines Kotlin's Parcelize feature, formerly part of Kotlin Android Extensions, as a production-ready way to generate Android Parcelable implementations. It discusses the feature's generated-code efficiency, plugin support, handling of unsupported types, and lack of runtime library overhead, then introduces the required Kotlin and Android Studio setup.

## Source excerpt

Life is too short to waste time on writing Parcelable code Two years ago, I wrote about how you can leverage features of the Kotlin programming language to manually write your Android Parcelable implementations in the most concise and readable way. Does it mean that I always prefer writing this code manually rather than letting a library or tool generate it for me? Of course not: like most developers, I believe that the best code is the code you don't have to write. But I expect the tools I use to meet my quality standards. That's why I tend to be conservative about the dependencies I add to my projects and will always favor official libraries from Jetbrains or Google over third-party solutions. Things have changed for the better since I wrote the previous article: with the release of Kotlin 1.3.40, @Parcelize is now a stable feature provided by the Parcelize Gradle plugin (formerly known as Kotlin Android Extensions). And since version 1.3.60, the Android Studio plugin also properly recognizes the feature as non-experimental so it can finally be considered as production-ready. I previously enumerated a list of some of the negative aspects of third-party Parcelable code generation libraries compared to manual implementation. Here's why I believe @Parcelize stands out from the rest in regard to that list: It's an official plugin made by JetBrains with the collaboration of Google and is guaranteed to be well supported in the future The generated code of @Parcelize is very efficient (as we'll discover further in this article) The CREATOR field doesn't have to be declared at all, along with that easy-to-forget @JvmField annotation Thanks to the Parceler interface, it is possible to write simple plugins to handle unsupported types or override the default implementation No extra classes are created by the plugin. All the generated code is embedded in the annotated class so the app will behave exactly as if you wrote the code yourself There is no runtime library overhead a