0

I am using @Parcelize to create parcable model with kotlin

@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

i got this error 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 version :: 1.3.61

Tried this but not solve the problem

Mahmoud Mabrok
  • 1,362
  • 16
  • 24
  • Does this answer your question? [Retrofit 2.0 + GSON Unable to invoke no-args constructor for interface](https://stackoverflow.com/questions/33749752/retrofit-2-0-gson-unable-to-invoke-no-args-constructor-for-interface) – denvercoder9 Jun 03 '20 at 16:00
  • no does not work with me – Mahmoud Mabrok Jun 03 '20 at 16:08

1 Answers1

1

Type this in Gradle

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

apply plugin: "kotlin-noarg"
VL93
  • 79
  • 3