0
votes

I am new to android development and in my app I am using room database to make entry into database .

But i am getting this error in appManager_impl class

AppDatabase_Impl is not abstract and does not override abstract method appDao() in AppDatabase public final class AppDatabase_Impl extends AppDatabase

My app manager class looks like this --

@Database(entities = [Data::class], version = 1, exportSchema = false)
abstract class AppDatabase : RoomDatabase() {

    abstract fun appDao() : AppDao


    companion object {

        @Volatile
        private var INSTANCE: AppDatabase? = null

        fun getAppDatabase(context: Context, name : String): AppDatabase? {
            if (INSTANCE == null) {
                INSTANCE = Room.databaseBuilder(
                    context.applicationContext,
                    AppDatabase::class.java, name
                ).build()
            }
            return INSTANCE
        }

        fun destroyInstance() {
            INSTANCE = null
        }
    }
}

1
can you please show your dependencies in your gradle - Taki
what are you using annotation processor or kapt in your build.gradle ? If it's annotation processor then try changing it to kapt and also apply plugin for kapt. - Mohammed Hanif.
the dependency that i am using are - def room_version = "2.2.5" implementation "androidx.room:room-runtime:$room_version" kapt "androidx.room:room-compiler:$room_version" // For Kotlin use kapt instead of annotationProcessor implementation "androidx.room:room-ktx:$room_version" implementation "androidx.room:room-rxjava2:$room_version" implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.8' implementation 'com.google.code.gson:gson:2.8.6' - Manmohan Gupta

1 Answers

1
votes

The dependencies that I have used:

def roomDatabaseVersion = '2.3.0-alpha02'

implementation "androidx.room:room-ktx:$roomDatabaseVersion"
implementation "androidx.room:room-runtime:$roomDatabaseVersion"
kapt "androidx.room:room-compiler:$roomDatabaseVersion"

So, please aware to use kapt also.