07-20-2023, 11:38 AM
I've found that another cause of this compilation error can be due to the use of the Room's `@Ignore` annotation on fields of your entity data class:
@Entity(tableName = "foo")
data class Foo(
// Okay
@PrimaryKey
val id: String,
// Okay
val bar: String,
// Annotation causes compilation error, all fields of data class report
// the "Cannot find setter for field" error when Ignore is present
@Ignore
val causeserror: String
)
The same error also seems to happens when using the `@Transient` annotation.
I've noticed this issue using version `2.2.2` of Room:
// build.gradle file
dependencies {
...
kapt "androidx.room:room-compiler:2.2.2"
...
}
Hope that helps someone!
@Entity(tableName = "foo")
data class Foo(
// Okay
@PrimaryKey
val id: String,
// Okay
val bar: String,
// Annotation causes compilation error, all fields of data class report
// the "Cannot find setter for field" error when Ignore is present
@Ignore
val causeserror: String
)
The same error also seems to happens when using the `@Transient` annotation.
I've noticed this issue using version `2.2.2` of Room:
// build.gradle file
dependencies {
...
kapt "androidx.room:room-compiler:2.2.2"
...
}
Hope that helps someone!