Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Room error: Schema '1.json' required for migration was not found at the schema out folder

I want to implement autoMigrations with Android Room

@Database(
    entities = [User1Message::class],
    version = 2,
    autoMigrations = [AutoMigration (from = 1, to = 2)],
    )
abstract class User1MessageDatabase : RoomDatabase() {

I also add this code in gradle

kapt {
    arguments {
        arg("room.schemaLocation", "$projectDir/schemas")
    }
}

But error message says that not found. enter image description here

1.json is in folder already

enter image description here

How to solve it?

UPDATE: User1MessageDatabase has only 2.json how to auto generate 1.json? enter image description here

like image 848
GHH Avatar asked Oct 24 '25 16:10

GHH


1 Answers

how to auto generate 1.json?

Revert the code to version 1, then add the exportSchema = true and then compile the project. Move to version 2.

like image 160
MikeT Avatar answered Oct 27 '25 06:10

MikeT



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!