LightCompressor icon indicating copy to clipboard operation
LightCompressor copied to clipboard

FileNotFoundException and ErrorNoException

Open desaikishan02 opened this issue 2 years ago • 2 comments

Screenshot from 2022-08-16 11-22-49 it gives an error like this in android 11 and android 12 so what i have to do

desaikishan02 avatar Aug 16 '22 05:08 desaikishan02

I have this issue on Google Pixel 3 XL with Android 12.

android.system.ErrnoException: open failed: ENOENT (No such file or directory)
    at libcore.io.Linux.open(Linux.java)
    at libcore.io.ForwardingOs.open(ForwardingOs.java:563)
    at libcore.io.BlockGuardOs.open(BlockGuardOs.java:274)
    at libcore.io.ForwardingOs.open(ForwardingOs.java:563)
    at android.app.ActivityThread$AndroidOs.open(ActivityThread.java:7728)
    at libcore.io.IoBridge.open(IoBridge.java:560)
    at java.io.FileInputStream.<init>(FileInputStream.java:160)
    at com.abedelazizshe.lightcompressorlibrary.VideoCompressor.saveVideoInInternal(VideoCompressor.kt:214)
    at com.abedelazizshe.lightcompressorlibrary.VideoCompressor.saveVideoFile(VideoCompressor.kt:180)
    at com.abedelazizshe.lightcompressorlibrary.VideoCompressor.access$saveVideoFile(VideoCompressor.kt:26)
    at com.abedelazizshe.lightcompressorlibrary.VideoCompressor$doVideoCompression$1.invokeSuspend(VideoCompressor.kt:104)
    at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
    at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
    at android.os.Handler.handleCallback(Handler.java:938)
    at android.os.Handler.dispatchMessage(Handler.java:99)
    at android.os.Looper.loopOnce(Looper.java:201)
    at android.os.Looper.loop(Looper.java:288)
    at android.app.ActivityThread.main(ActivityThread.java:7842)
    at java.lang.reflect.Method.invoke(Method.java)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1003)
java.io.FileNotFoundException: : open failed: ENOENT (No such file or directory)
    at libcore.io.IoBridge.open(IoBridge.java:574)
    at java.io.FileInputStream.<init>(FileInputStream.java:160)
    at com.abedelazizshe.lightcompressorlibrary.VideoCompressor.saveVideoInInternal(VideoCompressor.kt:214)
    at com.abedelazizshe.lightcompressorlibrary.VideoCompressor.saveVideoFile(VideoCompressor.kt:180)
    at com.abedelazizshe.lightcompressorlibrary.VideoCompressor.access$saveVideoFile(VideoCompressor.kt:26)
    at com.abedelazizshe.lightcompressorlibrary.VideoCompressor$doVideoCompression$1.invokeSuspend(VideoCompressor.kt:104)
    at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
    at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
    at android.os.Handler.handleCallback(Handler.java:938)
    at android.os.Handler.dispatchMessage(Handler.java:99)
    at android.os.Looper.loopOnce(Looper.java:201)
    at android.os.Looper.loop(Looper.java:288)
    at android.app.ActivityThread.main(ActivityThread.java:7842)
    at java.lang.reflect.Method.invoke(Method.java)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1003)

AS7C2 avatar Aug 25 '22 09:08 AS7C2

Hello everyone , I also have a problem with Android 13. Searching why it could fail, I have seen that the problem comes when it goes to save the file in the "saveVideoFile" method. In case the storageConfiguration.isExternal parameter is true, it ends up throwing exception, just when it does val fileUri = context.contentResolver.insert(collection, values) .

Attached the error that throws me, any help is welcome, thanks.

Captura de pantalla 2022-08-31 a las 9 56 21

AlejandroImbox avatar Aug 31 '22 08:08 AlejandroImbox

hello @desaikishan02 this is probably caused by the way android handles storage access for new version of android after API 29. google released scoped storage to access files outside of the app's directory and i assume light compressor is not yet ready for it. so the compression fails when the package tries to access the path outside of it's dir

Amberon-voldi avatar Oct 15 '22 20:10 Amberon-voldi

I am getting the same error while compressing the video and trying to write it into another directory. Might be URI is wrong I don't know what is the exact issue.

This is the URI I am trying to pass to the library: file:///storage/emulated/0/Download/pexels-cup-of-couple-7303657.mp4

LightCompressor Version: 1.2.0 Android SDK: 11,12 and 13.

Kindly request to you please fix this issue ASAP or suggest any alternatives.

ajitdubey-mob-ibtech avatar Nov 14 '22 08:11 ajitdubey-mob-ibtech