Java &引用;“对象”;不是此领域架构的一部分

Java &引用;“对象”;不是此领域架构的一部分,java,android,realm,kotlin,Java,Android,Realm,Kotlin,当我调用realm.where(MessageEventModel::class.java).findAll()时 它抛出了一个例外: 这是一个错误 java.lang.IllegalArgumentException: MessageEventModel is not part of the schema for this Realm at io.

当我调用
realm.where(MessageEventModel::class.java).findAll()时

它抛出了一个例外: 这是一个错误

java.lang.IllegalArgumentException: MessageEventModel is not part of the schema for this Realm
                                                                          at io.realm.internal.modules.CompositeMediator.getMediator(CompositeMediator.java:172)
                                                                     at io.realm.internal.modules.CompositeMediator.getTableName(CompositeMediator.java:90)
这是我的申请课

class MyApp : Application() {

override fun onCreate() {
    super.onCreate()
    Realm.init(this)
    val realmConfiguration = RealmConfiguration.Builder()
            .deleteRealmIfMigrationNeeded()
            .name("my_db")
            .build()
    Realm.setDefaultConfiguration(realmConfiguration)
}
}
这是我的领域模型

class MessageEventModel : RealmObject{
  constructor()
  var message = ""
  constructor(message: String) : this(){
    this.message = message
  }
}
这就是我试图检索模型的地方

class AwesomeChatFragment : Fragment() {

private val realm: Realm by lazy { Realm.getDefaultInstance() }
private var notifications: RealmResults<MessageEventModel>? = null

override fun onCreateView(inflater: LayoutInflater?, container: ViewGroup?, savedInstanceState: Bundle?): View? {
    val view = inflater?.inflate(R.layout.activity_awesome_chat, container, false)
    notifications = realm.where(MessageEventModel::class.java).findAll()
    return view
}
}
我尝试了在stack上找到的所有东西:
清理构建、重建项目、启用注释处理器、重新激活apk、使缓存无效/重新启动

gradle文件中的问题。由于@EpicPandaForce的评论,应用插件的排序规则问题已经解决,我正在写答案,以帮助他人,如果他们错过了@EpicPandaForce的评论答案

我改变了订单

apply plugin: 'com.android.application'
apply plugin: 'realm-android'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'


仅此而已,现在一切正常

我不久前遇到了这个问题(不同的领域版本)。看看这是否有帮助:在
领域之前应用
kotlin-android
kotlin-android-extensinos
,android
u是天才不,这也不行。王国现在已经浪费了大约2个小时在这个问题上,还没有解决方案!
apply plugin: 'com.android.application'
apply plugin: 'realm-android'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'realm-android'