Just leaving my answer in case that helps anyone. I ran into the same issue, none of the answers above worked. The only thing that worked was changing from a data class
to a class
. I invite anyone to try the same code and explain why It did the trick:
Before
@Entity
data class ImgurGalleryPost (
@NotNull @PrimaryKey
var id: String,
var title: String?,
var description: String?,
var datetime: Int?,
var cover: String?,
var coverWidth: Int?,
var coverHeight: Int?,
var accountUrl: String?,
var accountId: Int?,
var privacy: String?,
var layout: String?,
var views: Int?,
var link: String?,
var ups: Int?,
var downs: Int?,
var points: Int?,
var score: Int?,
var isAlbum: Boolean?,
var vote: Boolean?,
var favorite: Boolean?,
var nsfw: Boolean?,
var section: String?,
var commentCount: Int?,
var favoriteCount: Int?,
var topic: String?,
var topicId: Int?,
var imagesCount: Int?,
var inGallery: Boolean?,
var isAd: Boolean?,
@NotNull @Ignore
var tags: List<ImgurGalleryTag>,
var inMostViral: Boolean?,
@NotNull @Ignore
var images: List<ImgurGalleryImage>
)
After
@Entity
class ImgurGalleryPost (
@NotNull @PrimaryKey
var id: String,
var title: String?,
var description: String?,
var datetime: Int?,
var cover: String?,
var coverWidth: Int?,
var coverHeight: Int?,
var accountUrl: String?,
var accountId: Int?,
var privacy: String?,
var layout: String?,
var views: Int?,
var link: String?,
var ups: Int?,
var downs: Int?,
var points: Int?,
var score: Int?,
var isAlbum: Boolean?,
var vote: Boolean?,
var favorite: Boolean?,
var nsfw: Boolean?,
var section: String?,
var commentCount: Int?,
var favoriteCount: Int?,
var topic: String?,
var topicId: Int?,
var imagesCount: Int?,
var inGallery: Boolean?,
var isAd: Boolean?,
@NotNull @Ignore
var tags: List<ImgurGalleryTag>,
var inMostViral: Boolean?,
@NotNull @Ignore
var images:
List<ImgurGalleryImage>
)
It's really weird, but I doubt that is an Android Studio cache issue because changing it back to the data class
causes the error to show up again. Seems that is some kind of issue with the collection fields. I checked the constructor in the generated class and It looked fine, I don't know why the build was failing even when the constructor was being generated properly:
public ImgurGalleryPost(@org.jetbrains.annotations.NotNull()
java.lang.String id, @org.jetbrains.annotations.Nullable()
java.lang.String title, @org.jetbrains.annotations.Nullable()
java.lang.String description, @org.jetbrains.annotations.Nullable()
java.lang.Integer datetime, @org.jetbrains.annotations.Nullable()
java.lang.String cover, @org.jetbrains.annotations.Nullable()
java.lang.Integer coverWidth, @org.jetbrains.annotations.Nullable()
java.lang.Integer coverHeight, @org.jetbrains.annotations.Nullable()
java.lang.String accountUrl, @org.jetbrains.annotations.Nullable()
java.lang.Integer accountId, @org.jetbrains.annotations.Nullable()
java.lang.String privacy, @org.jetbrains.annotations.Nullable()
java.lang.String layout, @org.jetbrains.annotations.Nullable()
java.lang.Integer views, @org.jetbrains.annotations.Nullable()
java.lang.String link, @org.jetbrains.annotations.Nullable()
java.lang.Integer ups, @org.jetbrains.annotations.Nullable()
java.lang.Integer downs, @org.jetbrains.annotations.Nullable()
java.lang.Integer points, @org.jetbrains.annotations.Nullable()
java.lang.Integer score, @org.jetbrains.annotations.Nullable()
java.lang.Boolean isAlbum, @org.jetbrains.annotations.Nullable()
java.lang.Boolean vote, @org.jetbrains.annotations.Nullable()
java.lang.Boolean favorite, @org.jetbrains.annotations.Nullable()
java.lang.Boolean nsfw, @org.jetbrains.annotations.Nullable()
java.lang.String section, @org.jetbrains.annotations.Nullable()
java.lang.Integer commentCount, @org.jetbrains.annotations.Nullable()
java.lang.Integer favoriteCount, @org.jetbrains.annotations.Nullable()
java.lang.String topic, @org.jetbrains.annotations.Nullable()
java.lang.Integer topicId, @org.jetbrains.annotations.Nullable()
java.lang.Integer imagesCount, @org.jetbrains.annotations.Nullable()
java.lang.Boolean inGallery, @org.jetbrains.annotations.Nullable()
java.lang.Boolean isAd, @org.jetbrains.annotations.NotNull()
java.util.List<com.kimboo.core.model.ImgurGalleryTag> tags, @org.jetbrains.annotations.Nullable()
java.lang.Boolean inMostViral, @org.jetbrains.annotations.NotNull()
java.util.List<com.kimboo.core.model.ImgurGalleryImage> images) {
super();
}
If anyone can figure out a way to fix this without changing from data class
to class
please feel free to comment below.