I am developing Android project in Kotlin. I want to create a model class that implements Parcelable interface. This is what I tried:
@Parcelize
data class School(
@Expose val name: String?,
@Expose val address: String?,
): Parcelable
But I get compiler error saying that "Class School is not abstract and does not implement abstract memeber public abstract fun writeToParcel(p0: Parcel!, p1: Int):Unit
defined in android.os.Parcelable
".
I understand what the error is saying. But how to get rid of this error? My Kotlin version is 1.3.50
Add
androidExtensions {
experimental = true
}
to your Android block within your app build.gradle.