0

I am trying to get an advantage of auto-generated Parceable like (eg:) described here -

https://stackoverflow.com/a/63906355/5709159

or

https://medium.com/@BladeCoder/a-study-of-the-parcelize-feature-from-kotlin-android-extensions-59a5adcd5909

As far as I see the only requirement is declare the class as Parcelable and annotate it with @Parcelize like this:

@Parcelize
class Person(val name: String, val age: Int) : Parcelable

however, I get an error that says:

Class 'Person' is not abstract and does not implement abstract member public abstract fun describeContents(): Int defined in android.os.Parcelable

It forces me to implement these methods:

@Parcelize
class Person(val name: String, val age: Int) : Parcelable {
    override fun describeContents(): Int {
        TODO("Not yet implemented")
    }

    override fun writeToParcel(dest: Parcel, flags: Int) {
        TODO("Not yet implemented")
    }
}

It is not what is expected, what am I missing here?

Sirop4ik
  • 4,543
  • 2
  • 54
  • 121
  • 1
    Hey @Sirop4ik have a look here https://stackoverflow.com/questions/64991110/migrate-to-the-new-kotlin-parcelize – Kamal Nayan Apr 12 '23 at 12:37

1 Answers1

0

This is known bug, I think that is already fixed but you can check this youtrack ticket for more info. If it is fixed just update to version in which it is fixed and error should disappear.

Bottom line your code should work even with that error present.

krdzy
  • 31
  • 4