Datastore crash on android

Viewed 165

I have recently migrated to datastore on my application and a lot of my users seems to be getting this crash. I read that it could be happening becuase the data store file is corrupt and adding ReplaceFileCorruptionHandler when initialising data store will help.

I am on version datastore-preferences:1.0.0

The crashes have not stopped, any hints as to what could be the issue here?

Fatal Exception: androidx.datastore.core.a
Unable to parse preferences proto.

Fatal Exception: androidx.datastore.core.a: Unable to parse preferences proto.
       at androidx.datastore.preferences.PreferencesMapCompat$Companion.readFrom(PreferencesMapCompat.kt:33)
       at androidx.datastore.preferences.core.PreferencesSerializer.readFrom(PreferencesSerializer.kt:46)
       at androidx.datastore.core.SingleProcessDataStore.readData(SingleProcessDataStore.kt:381)
       at androidx.datastore.core.SingleProcessDataStore.readDataOrHandleCorruption(SingleProcessDataStore.kt:359)
       at androidx.datastore.core.SingleProcessDataStore.readAndInit(SingleProcessDataStore.kt:322)
       at androidx.datastore.core.SingleProcessDataStore.readAndInitOrPropagateAndThrowFailure(SingleProcessDataStore.kt:302)
       at androidx.datastore.core.SingleProcessDataStore.handleUpdate(SingleProcessDataStore.kt:281)
       at androidx.datastore.core.SingleProcessDataStore.access$getFile(SingleProcessDataStore.kt:76)
       at androidx.datastore.core.SingleProcessDataStore$actor$3.invokeSuspend(SingleProcessDataStore.kt:242)
       at androidx.datastore.core.SingleProcessDataStore$actor$3.invoke(SingleProcessDataStore.kt)
       at androidx.datastore.core.SingleProcessDataStore$actor$3.invoke(SingleProcessDataStore.kt)
       at androidx.datastore.core.SimpleActor$offer$2.invokeSuspend(SimpleActor.kt:122)
       at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
       at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
       at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:571)
       at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:750)
       at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:678)
       at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:665)
0 Answers
Related