从Play商店升级应用程序后,数据存储崩溃。最近我从共享首选项迁移到数据存储。这仅发生在像素 5 中,而不发生在 android 9 中。
以下是此崩溃的日志。
Fatal Exception: d1.n.a: Unable to parse preferences proto.
at androidx.datastore.preferences.PreferencesMapCompat$Companion.readFrom(PreferencesMapCompat.java:33)
at androidx.datastore.preferences.PreferencesSerializer.readFrom(PreferencesSerializer.java:39)
at androidx.datastore.preferences.PreferencesSerializer.<clinit>(PreferencesSerializer.java:34)
at androidx.datastore.SingleProcessDataStore.readData(SingleProcessDataStore.java:239)
at androidx.datastore.SingleProcessDataStore.readDataOrHandleCorruption(SingleProcessDataStore.java:218)
at androidx.datastore.SingleProcessDataStore.readAndInitOnce(SingleProcessDataStore.java:181)
at androidx.datastore.SingleProcessDataStore$actor$1.invokeSuspend(SingleProcessDataStore.java:145)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(BaseContinuationImpl.java:33)
at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.java:106)
at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.java:571)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.java:738)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.java:678)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.java:665)