I'm trying to populate my ROOM database with a simple JSON that I have inside the raw folder, this is my code
fun getInstance(context: Context): CarDatabase {
if(instance == null) {
instance = Room.databaseBuilder (
context,
CarDatabase::class.java, "cars_table"
).createFromAsset("app/res/raw/cars_sample.json").build()
}
return instance as CarDatabase
}
And I get this
Caused by: java.io.FileNotFoundException: app/res/raw/cars_sample.json