I'm new in room database and I have problem with Room.databasebuilder that shown an error not enough information to infer type variable T.
Here is my code
@Database(entities = [ThreadTable::class, GambarThreadTable::class], version = 2, exportSchema = false)
abstract class ThreadDb: RoomDatabase() {
companion object{
private var instance: ThreadDb? = null
fun getDb(context: Context): ThreadDb{
if (instance == null){
instance = Room.databaseBuilder(context.applicationContext, ThreadDb::class.java, "ThreadDb")
.fallbackToDestructiveMigration()
.build()
}
return instance as ThreadDb
}
}
abstract fun daoThread() : DaoThread
}
Room version
def room_version = "2.4.3"
implementation "androidx.room:room-runtime:$room_version"
implementation "androidx.room:room-ktx:$room_version"
kapt "androidx.room:room-compiler:$room_version"
The error occurs on ThreadDb::class.java, what should I change ? I have checked and tried some tutorials but nothing changed.