Collect crashing when choosing file from Downloads folder

I have observed that the ODK collect (Beta v2025.3.0-beta.2) is crashed when I was using File attachment question and selected a file and it has crashed if I select the file using ‘Downloads’ folder (Samsung A02s, Android 14). Thus, It becomes unable to pick the file from this folder and crashed spontaneously.
The reasons could not be understandable. please provide some advice. is this happening due to Samsung or could it be related to something else. Screenshot is attached. If I select same ‘Downloads’ folder accessing indirectly by first selecting via ‘Internal Memory’ or ‘SD Card‘ then it is working. is this a bug or android problem?

Thanks for reporting this issue! @dbemke Can you repro?

1 Like
Process: org.odk.collect.android, PID: 17834
java.lang.RuntimeException: An error occurred while executing doInBackground()
at android.os.AsyncTask$4.done(AsyncTask.java:415)
at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:434)
at java.util.concurrent.FutureTask.setException(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:322)
at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:305)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1156)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:651)
at java.lang.Thread.run(Thread.java:1119)
Caused by: java.lang.SecurityException: com.samsung.android.providers.media has no access to content://media/external_primary/file/1000186932
at android.os.Parcel.createExceptionOrNull(Parcel.java:3091)
at android.os.Parcel.createException(Parcel.java:3075)
at android.os.Parcel.readException(Parcel.java:3058)
at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:190)
at android.database.DatabaseUtils.readExceptionWithFileNotFoundExceptionFromParcel(DatabaseUtils.java:153)
at android.content.ContentProviderProxy.openTypedAssetFile(ContentProviderNative.java:814)
at android.content.ContentResolver.openTypedAssetFileDescriptor(ContentResolver.java:2043)
at android.content.ContentResolver.openAssetFileDescriptor(ContentResolver.java:1858)
at android.content.ContentResolver.openInputStream(ContentResolver.java:1528)
at org.odk.collect.android.utilities.FileUtils.saveAnswerFileFromUri(FileUtils.java:96)
at org.odk.collect.android.tasks.MediaLoadingTask.doInBackground(MediaLoadingTask.java:60)
at org.odk.collect.android.tasks.MediaLoadingTask.doInBackground(MediaLoadingTask.java:32)
at android.os.AsyncTask$3.call(AsyncTask.java:394)
at java.util.concurrent.FutureTask.run(FutureTask.java:317)
at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:305) 
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1156) 
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:651) 
at java.lang.Thread.run(Thread.java:1119)

We tried to reproduce it but we haven’t encountered this issue yet. Probably next week we’ll have a similar device with the SD card to test so we’ll continue testing then.

1 Like

I was able to reproduce a similar crash by restricting some file access. @M_Asif_Hussain could you try the following:

  1. Open your Android Settings.

  2. Search for “All files access” and open it.

  3. Tap the three-dot menu in the top-right corner and select “Show system apps”.

  4. Make sure that access is enabled for all apps that might be related, such as External Storage, My Files, Storage Manager, etc.

When I disabled some of these I reproduced the crash.

1 Like

By the way I have given all the permission after that it is crashing. Yes, there is something wrong with managing permissions in the app which needs to be resolved.

@M_Asif_Hussain Could you try another app that uses the same method for file selection? Signal is one example. When you try to send someone a file, it displays the same file picker.

I have now tried using ‘Signal’ app and found similar issue. If I directly pick a file attachment from ‘Downloads‘ it did nothing. I have to select the file by via Internal memory or SD Card options. Same issue happened in this case also.

I have now tried using ‘Signal’ app and found similar issue.

That’s what I thought. It seems to be a Samsung bug. The only difference between ODK Collect and Signal is that Signal catches the exception and doesn’t crash.

@M_Asif_Hussain
I also tried to reproduce your issue, but I was able to do so only with additional steps provided by @Grzesiek2010 .
When all related apps were Enabled then everything works fine on my Samsung Galaxy M23 device with SD card.