RoomDatabase_Impl不存在 [英] RoomDatabase_Impl does not exist

查看:391
本文介绍了RoomDatabase_Impl不存在的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我尝试实施会议室数据库时,出现以下错误:

I when try to implement a Room Database, I get the following error:

java.lang.RuntimeException: cannot find implementation for com.udacity.gradle.builditbigger.Database.HilarityUserDatabase. HilarityUserDatabase_Impl does not exist
                                                 at android.arch.persistence.room.Room.getGeneratedImplementation(Room.java:92)

我尝试将相关的kotlin依赖项添加到我的gradle文件中(如下所示),但是当我这样做时,通常会出现任何问题的所有Databinding类现在都在我的gradle控制台中生成了错误.我可以使用DataBinding库和Room Pesistence库吗?

I tried adding the relevant kotlin dependencies to my gradle file (shown below) but when I do, all of my Databinding classes that would normally be generated with any issues are now generating errors in my gradle console. Is there way for me to use the DataBinding library and the Room Pesistence Library?

apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-kapt'
...
dependencies{
    kapt "android.arch.persistence.room:compiler:1.0.0"
}

推荐答案

我以前确实发生过这种情况,请确保您在build.gradle中具有所有3个依赖项

It did happen to me before, make sure that you have all 3 dependencies in build.gradle

implementation 'android.arch.persistence.room:runtime:1.0.0'
annotationProcessor  'android.arch.persistence.room:compiler:1.0.0'
kapt 'android.arch.persistence.room:compiler:1.0.0'

此外,在gradle同步之后执行项目清理"也将有所帮助.

Also, a "Project Clean" after gradle synch will help as well.

这篇关于RoomDatabase_Impl不存在的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆