How do I replace annotation class Parcelize from package kotlinx.android.parcel with Parcelize which is not coming from the kotlin-android-extensions plugin?
Just update your import
from: import kotlinx.android.parcel.Parcelize
to the: import kotlinx.parcelize.Parcelize
With Groovy
build.gradle (project level)
dependencies {
// .... project level dependencies
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.5.20-RC"
}
build.gradle (app level)
plugins {
...
id 'kotlin-parcelize'
}
and the data class
import android.os.Parcelable
import kotlinx.parcelize.Parcelize
@Parcelize
class User(
val firstName: String,
val lastName: String,
val age: Int
): Parcelable
you can find the latest version here https://plugins.gradle.org/plugin/org.jetbrains.kotlin.plugin.parcelize