如何在Kotlin Realm Extention中修复“功能不是此域的架构的一部分”

时间:2017-11-02 03:27:01

标签: android kotlin realm

我想使用这个Kotlin Realm Extention库将Realm与Kotlin一起使用。我已将mavenCentral()存储库和compile "com.github.vicpinm:krealmextensions:1.2.0"添加到a​​pp.gradle。

当我运行我的应用程序时,我收到此错误: java.lang.IllegalArgumentException: Feature is not part of the schema for this Realm. Did you added realm-android plugin in your build.gradle

我曾尝试在app.gradle中添加apply: realm-android,但它不起作用(旁边我认为它应该是从库中调用的)。我也在我的Activity中添加了Realm.init(baseContext),因为查询操作需要它。

1 个答案:

答案 0 :(得分:1)

您的插件订单必须

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