Home » Android » android – RoomDatabase_Impl does not exist

android – RoomDatabase_Impl does not exist

Posted by: admin May 14, 2020 Leave a comment


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)

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'
    kapt "android.arch.persistence.room:compiler:1.0.0"
How to&Answers:

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'

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


Make sure kotlin-kapt is included in app-level gradle file.

apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-kapt'

and make sure you use kapt instead of annotationProcessor. That solved my problem.

And also check Room Model, DAO, and Database files for @Entity, @Dao and @Database annotations.


For usage of Room, LiveData and ViewModel you need these libraries:

•implementation "android.arch.persistence.room:runtime:1.0.0"
•implementation "android.arch.lifecycle:extensions:1.1.0"
•kapt "android.arch.persistence.room:compiler:1.0.0"
•kapt "android.arch.lifecycle:compiler:1.1.0"

LiveData and ViewModel allows you to use the DataBinding technique.

For more info check the official page: https://developer.android.com/topic/libraries/architecture/adding-components.html


For the newer version of the room compiler don’t need to add both dependencies, Just do the following –

kapt 'android.arch.persistence.room:compiler:2.2.3'