question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Cannot compress to data directory

See original GitHub issue

Cannot compress to ContextCompat.getDataDir(context) to not ask storage permission. In version 1.0.1 it worked without problems. Now it crashes:

 java.lang.IllegalArgumentException: Primary directory (invalid) not allowed for content://media/external_primary/video/media; allowed directories are [DCIM, Movies, Pictures]
        at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:172)
        at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:142)
        at android.content.ContentProviderProxy.insert(ContentProviderNative.java:557)
        at android.content.ContentResolver.insert(ContentResolver.java:2218)
        at android.content.ContentResolver.insert(ContentResolver.java:2173)
        at com.abedelazizshe.lightcompressorlibrary.VideoCompressor.saveVideoFile(VideoCompressor.kt:179)
        at com.abedelazizshe.lightcompressorlibrary.VideoCompressor.access$saveVideoFile(VideoCompressor.kt:24)
        at com.abedelazizshe.lightcompressorlibrary.VideoCompressor$doVideoCompression$1.invokeSuspend(VideoCompressor.kt:99)
        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:233)
        at android.os.Looper.loop(Looper.java:344)
        at android.app.ActivityThread.main(ActivityThread.java:8191)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:584)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1034)

Issue Analytics

  • State:open
  • Created a year ago
  • Comments:8 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
Andoctoreycommented, Jul 31, 2022
  1. Updated from 1.0.1 to 1.2.0.
  2. Made following config:
val convertingFile = File(ContextCompat.getExternalFilesDirs(context, null), video.mp4)
convertingFile.createNewFile()
storageConfiguration = StorageConfiguration(
                        saveAt =convertingFile.path,
                        isExternal = false,
                    ),
  1. Removed storage permission
  2. Got following error:

compress /storage/emulated/0/Android/data/app.package/files/media/FSa5CPc9UQSrQLi1jYA8bZsdVNI3/-N8JkLYRwKD02H1FUxTr/1659279748873.mp0.tmp

2022-07-31 22:02:45.552 9628-9628/app.ploshcha E/AndroidRuntime: FATAL EXCEPTION: main Process: app.package, PID: 9628 java.io.FileNotFoundException: : open failed: ENOENT (No such file or directory) at libcore.io.IoBridge.open(IoBridge.java:575) 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:233) at android.os.Looper.loop(Looper.java:344) at android.app.ActivityThread.main(ActivityThread.java:8210) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:584) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1034) Suppressed: kotlinx.coroutines.DiagnosticCoroutineContextException: [StandaloneCoroutine{Cancelling}@4a2695f, Dispatchers.Main] Caused by: android.system.ErrnoException: open failed: ENOENT (No such file or directory) at libcore.io.Linux.open(Native Method) at libcore.io.ForwardingOs.open(ForwardingOs.java:567) at libcore.io.BlockGuardOs.open(BlockGuardOs.java:273) at libcore.io.ForwardingOs.open(ForwardingOs.java:567) at android.app.ActivityThread$AndroidOs.open(ActivityThread.java:8092) at libcore.io.IoBridge.open(IoBridge.java:561) … 15 more

2reactions
Afaquejayacommented, Jun 9, 2022

Device Name ; Poco F1 Android 10 It only compress below 1min video & video also not get played What is the max size of the video that can be compressed? & for 1Gb Video how can we decrease the compression time?

Read more comments on GitHub >

github_iconTop Results From Across the Web

If you can't compress a file or folder on Mac - Apple Support
If you can't compress a file or folder on Mac · On your Mac, select the item, then choose File > Get Info,...
Read more >
Why can't I compress a folder? | Finddiffer.com
If you can't compress your files and folders, check the permissions settings for those items. If permissions aren't correct, you might not be...
Read more >
Cannot Compress Files - Microsoft Community
Hi,. I am not able to send a folder full of .oog audio files (297mb total) to be compressed by righting clicking &...
Read more >
The compression cannot be performed because the path to ...
The compression cannot be performed because the path to the file or directory 'Application Data' is too long. Is there any way to...
Read more >
I cannot compress files on an NTFS partition. - ITPro Today
the cause is normally that the cluster size of the NTFS partition is greater than 4096. To check the cluster size of your...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found