Disabling sqlite Write-Ahead logging in Android Pie

前端 未结 5 647
天涯浪人
天涯浪人 2021-01-04 18:56

In Android Pie sqlite Write-Ahead logging (WAL) has been enabled by default. This is causing errors for my existing code only in Pie devices. I have been unable to turn off

5条回答
  •  迷失自我
    2021-01-04 19:02

    If you are using Room, you won't have direct access to the database but you can instead set the journal mode when you are building/opening the database:

    db = Room.databaseBuilder(context, Database.class, "Database")
             .setJournalMode(JournalMode.TRUNCATE)
             .build();
    

提交回复
热议问题