I have one open class like this
open class NewsResponse(
@field:SerializedName("news")
val news: List<NewsItem?>? = null
):RealmObject()
And NewsItem class like this
open class NewsItem(
@field:SerializedName("created")
val created: String? = null,
@field:SerializedName("link")
val link: String? = null,
@field:SerializedName("description")
val description: String? = null,
@field:SerializedName("title")
val title: String? = null
):RealmObject()
I have also added
apply plugin: 'com.android.application'
apply plugin: 'kotlin-kapt'
apply plugin: 'realm-android'
apply plugin: 'kotlin-android'
apply plugin: 'io.fabric'
apply plugin: 'kotlin-android-extensions'
these plugins in app gradle
I have classpath "io.realm:realm-gradle-plugin:5.1.0"
in project level gradle.
So when I run the app, I get an error saying
Caused by: io.realm.exceptions.RealmException: NewsItem is not part of the schema for this Realm
at io.realm.internal.modules.CompositeMediator.getMediator(CompositeMediator.java:180)
How to solve this problem?
Use this order:
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-kapt'
apply plugin: 'realm-android'
apply plugin: 'io.fabric'
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With