我用 Parcalize 得到“错误无法为 class CLASSNAME 调用无参数构造函数”

I got " Error Unable to invoke no-args constructor for class CLASSNAME" with Parcalize

我正在使用 @Parcelize 通过 kotlin 创建 parcable 模型

@Parcelize
data class GymPackage(
    val id: Int?,
    val name: String?,
    val description: String?,
    val price: Int?,
    val duration: Int?,
    @SerializedName("discount_precentage")
    val discountPrecentage: Int?,
    @SerializedName("price_after_discount")
    val priceAfterDiscount: Double?,
    @SerializedName("gym_id")
    val gymId: Int?

) : Parcelable

我遇到了这个错误Error Unable to invoke no-args constructor for class com.inova.algym.datalayer.remote.responses.GymPackage. Registering an InstanceCreator with Gson for this type may fix this problem.

koltin 版本 :: 1.3.61

试过但没有解决问题

在 Gradle

中输入
buildscript {
    dependencies {
        classpath "org.jetbrains.kotlin:kotlin-noarg:$kotlin_version"
    }
}

apply plugin: "kotlin-noarg"