Closed SebastianSchildt closed 7 months ago
Crashlog:
FATAL EXCEPTION: main
Process: org.eclipse.kuksa.companion, PID: 27985
java.lang.IllegalStateException: There are multiple DataStores active for the same file: /data/user/0/org.eclipse.kuksa.companion/files/datastore/connection_info. You should either maintain your DataStore as a singleton or confirm that there is no two DataStore's active on the same file (by confirming that the scope is cancelled).
at androidx.datastore.core.SingleProcessDataStore$file$2.invoke(SingleProcessDataStore.kt:168)
at androidx.datastore.core.SingleProcessDataStore$file$2.invoke(SingleProcessDataStore.kt:163)
at kotlin.SynchronizedLazyImpl.getValue(LazyJVM.kt:74)
at androidx.datastore.core.SingleProcessDataStore.getFile(SingleProcessDataStore.kt:163)
at androidx.datastore.core.SingleProcessDataStore.readData(SingleProcessDataStore.kt:380)
at androidx.datastore.core.SingleProcessDataStore.readDataOrHandleCorruption(SingleProcessDataStore.kt:359)
at androidx.datastore.core.SingleProcessDataStore.readAndInit(SingleProcessDataStore.kt:322)
at androidx.datastore.core.SingleProcessDataStore.readAndInitOrPropagateFailure(SingleProcessDataStore.kt:311)
at androidx.datastore.core.SingleProcessDataStore.handleRead(SingleProcessDataStore.kt:261)
at androidx.datastore.core.SingleProcessDataStore.access$handleRead(SingleProcessDataStore.kt:76)
at androidx.datastore.core.SingleProcessDataStore$actor$3.invokeSuspend(SingleProcessDataStore.kt:239)
at androidx.datastore.core.SingleProcessDataStore$actor$3.invoke(Unknown Source:8)
at androidx.datastore.core.SingleProcessDataStore$actor$3.invoke(Unknown Source:4)
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:108)
at kotlinx.coroutines.internal.LimitedDispatcher$Worker.run(LimitedDispatcher.kt:115)
at kotlinx.coroutines.scheduling.TaskImpl.run(Tasks.kt:103)
at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:584)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:793)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:697)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:684)
Suppressed: kotlinx.coroutines.internal.DiagnosticCoroutineContextException: [StandaloneCoroutine{Cancelling}@cde7ce9, Dispatchers.Main.immediate]
Crash happens because the Android DataStore is created a second time during the re-creation of the activity which happens due to the orientation change. Can be fixed by either:
Describe the bug Starts in portait mode, if turning the phone, during rotation to landscape mode, the app crashes
Observed on: Android 13, Galaxy A22 5G