Today I wanted to make a
data class a Parcelable so that I could pass it as an argument in Navigation component.
Parcelables, though better in performance than Serializables, take more time to implement! To help us out, there’s a “kotlin-parcelize” plugin that can generate the boilerplate code for us.
There were issues though.
After applying the kotlin-parcelize plugin, I was getting the error:
'kotlin-parcelize' can't be applied together with 'kotlin-android-extensions'
So kotlin-parcelize is like a “successor” to the now deprecated
'kotlin-android-extensions' that I’m still using. So I replaced
'kotlin-android-extensions' with ‘kotlin-parcelize’.
I got another error after attempting to sync with my Gradle files:
</code><code>org.gradle.api.GradleScriptException: A problem occurred evaluating project ':app'
Caused by: groovy.lang.MissingMethodException: No signature of method: build_54gmhuqjm83le8li4fspjsxlu.android() is applicable for argument types: (build_54gmhuqjm83le8li4fspjsxlu$_run_closure1) values: [[email protected]]
The solution was to remove the following code from my
</strong>experimental = true
After removing that, Gradle synced successfull!
Parcelable implementation generator
How to use @Parcelize now that kotlin-android-extensions is being deprecated?