Skip to content

[BUG] Crash when calling SumUpState.init(this) more than once #268

@HiIAmMoot

Description

@HiIAmMoot

Summary

When calling SumUpState.init(this) more than once, the app crashes. This happens on 7.0.0, I've not tested 6.0.0 but it didn't happen in 5.0.4.

Steps to Reproduce

Call SumUpState.init(this) after calling it before and logging in.

Expected Behavior

It would at the very least not crash.

Actual Behavior

The app crashes.

Android Version(s)

Earliest version I've tested on: Android 12
Latest version I've tested on: Android 16
Both crash.

Impacted Devices

I've tested on a Lenovo Tab M9 & a Samsung Galaxy S23

Impacted Readers

Unrelated to readers, this happens both when connected or unconnected.

Firmware Version(s)

No specific firmware version

Crash Log

FATAL EXCEPTION: main Process: com.example.sumupapp, PID: 17773 java.lang.IllegalStateException: There are multiple DataStores active for the same file: /data/user/0/com.example.sumupapp/files/datastore/environment_datastore.preferences_pb. 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.okio.OkioStorage.createConnection(OkioStorage.kt:65) at androidx.datastore.core.DataStoreImpl$storageConnectionDelegate$1.invoke(DataStoreImpl.kt:181) at androidx.datastore.core.DataStoreImpl$storageConnectionDelegate$1.invoke(DataStoreImpl.kt:180) at kotlin.SynchronizedLazyImpl.getValue(LazyJVM.kt:86) at androidx.datastore.core.DataStoreImpl.getStorageConnection$datastore_core_release(DataStoreImpl.kt:183) at androidx.datastore.core.DataStoreImpl$coordinator$2.invoke(DataStoreImpl.kt:184) at androidx.datastore.core.DataStoreImpl$coordinator$2.invoke(DataStoreImpl.kt:184) at kotlin.SynchronizedLazyImpl.getValue(LazyJVM.kt:86) at androidx.datastore.core.DataStoreImpl.getCoordinator(DataStoreImpl.kt:184) at androidx.datastore.core.DataStoreImpl.readAndInitOrPropagateAndThrowFailure(DataStoreImpl.kt:264) at androidx.datastore.core.DataStoreImpl.access$readAndInitOrPropagateAndThrowFailure(DataStoreImpl.kt:48) at androidx.datastore.core.DataStoreImpl$readState$2.invokeSuspend(DataStoreImpl.kt:218) at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:34) at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:100) at kotlinx.coroutines.internal.LimitedDispatcher$Worker.run(LimitedDispatcher.kt:124) at kotlinx.coroutines.scheduling.TaskImpl.run(Tasks.kt:89) at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:586) at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:820) at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:717) at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:704) Suppressed: kotlinx.coroutines.internal.DiagnosticCoroutineContextException: [StandaloneCoroutine{Cancelling}@8c51bfe, Dispatchers.Main.immediate]

Dependency Versions

  • SumUp SDK: 7.0.0
  • Kotlin: 2.2.21
  • Android Gradle Plugin: 8.9.1
  • Gradle: 8.13

Video / Screenshot

Other Information

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions