我想通过这个 Kotlin Realm Extention 将 Realm 与 Kotlin 结合使用图书馆。我添加了 mavenCentral()
存储库并将 compile "com.github.vicpinm:krealmeextensions:1.2.0"
到 app.gradle。
当我运行我的应用程序时,出现以下错误:
java.lang.IllegalArgumentException:功能不是此 Realm 架构的一部分。您是否在 build.gradle 中添加了 realm-android 插件
我尝试在 app.gradle 中添加 apply: realm-android
但它不起作用(此外我认为它应该从库内部调用)。我还在 Activity 中添加了 Realm.init(baseContext)
,因为查询操作需要它。
最佳答案
你的插件顺序需要是</p>
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-kapt'
apply plugin: 'realm-android'
关于android - 如何修复 Kotlin Realm 扩展中的 "Feature is not part of the schema for this Realm",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47067112/