Q:

Pre seeding Room Database is not working but database is created in Kotlin

I am trying to pre-seed my database in Kotlin using Room Database. It doesn't give me any error when I Build and Run it and the database gets created but it is not seeded. Please see my code below:
FareMatrix.kt
import androidx.room.Entity
import androidx.room.PrimaryKey

@Entity(tableName = "fare_matrix")
data class FareMatrix(
    @PrimaryKey
    var id: Int = 0,
    val entry_plaza: Int? = null,
    val exit_plaza: Int? = null,
    val classification: Int? = null,
    val amt_total: Int? = null,
    val vat: Double? = null,
    val payment_mode: Int? = null
)

fareMatrixDao
import androidx.room.Dao
import androidx.room.Insert
import androidx.room.Query

@Dao
interface FareMatrixDao {
    @Insert
    fun addFareMatrix(fareMatrix: List<FareMatrix>)
}

FareMatrixDatabase
import android.content.Context
import androidx.room.Database
import androidx.room.Room
import androidx.room.RoomDatabase
import androidx.sqlite.db.SupportSQLiteDatabase

@Database(
    entities = [FareMatrix::class],
    version = 9
)
abstract class LcsDatabase: RoomDatabase() {

    abstract fun getFareMatrixDao(): FareMatrixDao

    companion object {
        @Volatile private var instance: LcsDatabase? = null
        private val lock = Any()

        operator fun invoke(context: Context) = instance ?: synchronized(lock){
            instance ?: buildDatabase(context).also {
                instance = it
            }
        }

        private fun buildDatabase(context: Context) = Room.databaseBuilder(
            context.applicationContext,
            LcsDatabase::class.java,
            "lcsdatabase.db"
        ).fallbackToDestructiveMigration()
            .addCallback(object: Callback() {
                override fun onCreate(db: SupportSQLiteDatabase) {
                    super.onCreate(db)

                    Thread(Runnable {
                        seeDatabase(context)
                        println("END")
                    }).start()
                }
            })
            .build()

        fun seeDatabase(context: Context) {
            val POPULATED_FAREMATRIX_DATA = listOf<FareMatrix>(
                FareMatrix(1,800,803,1,30,3.21,1),
                FareMatrix(2,800,803,2,75,8.04,1),
                FareMatrix(3,800,803,3,90,9.64,1),
                FareMatrix(4,800,805,1,58,6.21,1),
                FareMatrix(5,800,805,2,145,15.54,1)
            )
            val db = invoke(context)
            var fmDao = db.getFareMatrixDao()
            fmDao.addFareMatrix(POPULATED_FAREMATRIX_DATA)
        }
    }
}

I even tried using this way:
fun seeDatabase(context: Context) {
            val POPULATED_FAREMATRIX_DATA = listOf<FareMatrix>(
                FareMatrix(1,800,803,1,30,3.21,1),
                FareMatrix(2,800,803,2,75,8.04,1),
                FareMatrix(3,800,803,3,90,9.64,1),
                FareMatrix(4,800,805,1,58,6.21,1),
                FareMatrix(5,800,805,2,145,15.54,1)
            )
            val db = invoke(context)
            var fmDao = db.getFareMatrixDao()
            for (i in POPULATED_FAREMATRIX_DATA) {
                fmDao.addFareMatrix(FareMatrix(i.id, i.entry_plaza, i.exit_plaza, i.classification, i.amt_total, i.vat, i.payment_mode))
            }
        }

DAO
 @Insert
    fun addFareMatrix(fareMatrix: FareMatrix)

I really can't get it to work. I need your help please. Thank you.

A:

Maybe you can try with kotlin coroutines. Your code is good so far but maybe something is bad formated during the insertation of data. So i suggest you to use the kotlinx.coroutines and doing that, in your invoke method at the end of it, you can just use something like 
   operator fun invoke(context: Context) = instance ?: synchronized(LOCK) {
      instance ?: buildDatabase(context).also {
            instance = it

      GlobalScope.launch {
            val POPULATED_FAREMATRIX_DATA = listOf<FareMatrix>(
            FareMatrix(1,800,803,1,30,3.21,1),
            FareMatrix(2,800,803,2,75,8.04,1),
            FareMatrix(3,800,803,3,90,9.64,1),
            FareMatrix(4,800,805,1,58,6.21,1),
            FareMatrix(5,800,805,2,145,15.54,1)
        )
           POPULATED_FAREMATRIX_DATA.forEach { something -> it.getFareMatrixDao().addFareMatrix(something) }
     }
 }}

That should work like a charm. Everything else looks good.
Edit:  and your building database method should end with 
.fallbackToDestructiveMigration().build(). You don't need to add anything else

