zetbaitsu / Compressor

An android image compression library.
7.09k stars 963 forks source link

FileNotFound exception after updating to v3.0.0 #175

Open rakeshparveen5 opened 3 years ago

rakeshparveen5 commented 3 years ago

java.io.FileNotFoundException: /data/user/0/com.gdso.execushield/cache/compressor/30ffa12f-bb8a-4a3f-a9bc-fb1f6a278b5a-1611040506061.png (No such file or directory) at java.io.FileInputStream.open0(Native Method) at java.io.FileInputStream.open(FileInputStream.java:231) at java.io.FileInputStream.(FileInputStream.java:165) at java.io.FileInputStream.(FileInputStream.java:112) at android.media.ExifInterface.(ExifInterface.java:1335) at id.zelory.compressor.UtilKt.determineImageRotation(Util.kt:70) at id.zelory.compressor.constraint.DefaultConstraint.satisfy(DefaultConstraint.kt:29) at id.zelory.compressor.Compressor$compress$3.invokeSuspend(Compressor.kt:28) at id.zelory.compressor.Compressor$compress$3.invoke(Unknown Source:10) at kotlinx.coroutines.intrinsics.UndispatchedKt.startUndispatchedOrReturn(Undispatched.kt:91) at kotlinx.coroutines.BuildersKt__Builders_commonKt.withContext(Builders.common.kt:160) at kotlinx.coroutines.BuildersKt.withContext(Unknown Source:1) at id.zelory.compressor.Compressor.compress(Compressor.kt:23) at id.zelory.compressor.Compressor.compress$default(Compressor.kt:22) at app.helpers.MediaHelper.compressImageToThumbnail(MediaHelper.kt:70) at app.ui.MainActivity$onCreate$6$1.invokeSuspend(MainActivity.kt:193) at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33) at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:56) at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:571) at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:738) at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:678) at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:665)

nareshkatta99 commented 3 years ago

Did you update the targetSdkVersion recently? If so, check if you are using legacy storage support or not. This library might need that.

litian1993 commented 1 year ago

Did you update the targetSdkVersion recently? If so, check if you are using legacy storage support or not. This library might need that.

set the targetSdkVersion to 26 and requestLegacyExternalStorage is true in AndroidMaifest.xml but also has the same issue and i think use the context.externalCacheDir instead of context.cacheDir maybe can fix this issue