In SQLiteOpenHelper there is a onCreate(SQLiteDatabase ...) method which i used to populate database tables with some initial data.
I was struggling with this topic too and this solution worked for me:
// build.gradle
def room_version = "2.2.5"
// Room
implementation "androidx.room:room-runtime:$room_version"
kapt "androidx.room:room-compiler:$room_version"
implementation "androidx.room:room-ktx:$room_version"
In your App class:
// virtually create the db
val db = Room.databaseBuilder(
appContext, AppDatabase::class.java,
Res.getString(R.string.dbname)
).createFromAsset(Res.getString(R.string.source_db_name)).build()
// first call to db really creates the db on filesystem
db.query("SELECT * FROM " + Room.MASTER_TABLE_NAME, null)