我有一个像这样的公开课
open class NewsResponse(
@field:SerializedName("news")
val news: List<NewsItem?>? = null
):RealmObject()
像这样的 NewsItem 类
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()
我还添加了
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'
app gradle 中的这些插件
我有classpath "io.realm:realm-gradle-plugin:5.1.0"
项目级别的gradle。所以当我运行应用程序时,我收到一条错误消息
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)
如何解决这个问题呢?