0

Since I updated from Kotlin 1.5.10 to 1.5.20 I am having a build issue due to models.

I am getting : Note: PrimaryKey[childId] is overridden by PrimaryKey[parentId]

My objects are :

@Entity
class Parent : Child() {
    @ColumnInfo(name = "parent_id")
    @PrimaryKey(autoGenerate = true)
    var parentId: Int? = null

    @SerializedName("name")
    var name: String? = null

    ...
}

and

@Entity
open class Child(
    @ColumnInfo(name = "child_id")
    @PrimaryKey(autoGenerate = true)
    var childId: Int? = null,

    @SerializedName("description")
    var description: String? = null

    ...

) : Serializable {...}

Note that with Kotlin 1.5.10 I have no build issue. I tried to remove the @PrimaryKey of the child but I get another error saying @Entity must have a PrimaryKey

Am I missing something? Thanks for your help

Romain Barbier
  • 208
  • 2
  • 11

1 Answers1

0

Because in the same build I also had issues about expected @androidentrypoint to have a value I have done some research about it and found this: Expected @AndroidEntryPoint to have a value. Did you forget to apply the Gradle Plugin?

Leading to https://stackoverflow.com/a/68141101/9606199

and to https://github.com/google/dagger/issues/2684#issuecomment-860250964

So I tried it and it worked (still having this error but the build is now ok). It looks like it is a bug in Kotlin 1.5.20

Romain Barbier
  • 208
  • 2
  • 11