Skip to content

File already exist exception when attempting to compress some images (random) #208

Description

@YsrBouhamria

Hey, I keep getting this crash on some instances, can't really reproduce, any idea what could be wrong?
It happens in devices running android 8, until 13
Fatal Exception: kotlin.io.FileAlreadyExistsException: /data/user/0/com.my.app/files/IMG_20230531_100341.jpg -> /data/user/0/com.my.app/cache/compressor/IMG_20230531_100341.jpg: Tried to overwrite the destination, but failed to delete it.
at kotlin.io.FilesKt__UtilsKt.copyTo(Utils.kt:226)
at kotlin.io.FilesKt__UtilsKt.copyTo$default(Utils.kt:217)
at id.zelory.compressor.UtilKt.copyToCache(Util.kt:82)
at id.zelory.compressor.Compressor$compress$3.invokeSuspend(Compressor.kt:25)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
at kotlinx.coroutines.internal.LimitedDispatcher.run(LimitedDispatcher.kt:42)
at kotlinx.coroutines.scheduling.TaskImpl.run(Tasks.kt:95)
at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:570)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:750)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:677)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:664)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions