In my Android app, I want to add a Bundle including a Place
object described below to my Intent. Since serializable was slow and not recommended, I preferred Parcelable.
Althoug I use Kotlin 1.3.31, I have problems parcelizing some data classes. Example:
import android.os.Parcelable
import kotlinx.android.parcel.Parcelize
@Parcelize
data class Place(val street: String, val postal: String, val city: String) : Parcelable
and Android Studio complains:
Class 'Place' is not abstract and does not implement abstract member public abstract fun writeToParcel(p0: Parcel!, p1: Int): Unit defined in android.os.Parcelable
According to some tutorials
That’s it! You don’t need to write any parcel methods anymore!
https://android.jlelse.eu/yet-another-awesome-kotlin-feature-parcelize-5439718ba220
and I do not want to use
androidExtensions {
experimental = true
}
in production stuff.
What alternatives would I have here?