I am seeing this stack trace in Crashlytics:
Fatal Exception: java.lang.SecurityException: Unsupported path /storage/emulated/0/Download
at android.os.Parcel.createExceptionOrNull(Parcel.java:3023)
at android.os.Parcel.createException(Parcel.java:3007)
at android.os.Parcel.readException(Parcel.java:2990)
at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:190)
at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:142)
at android.content.ContentProviderProxy.insert(ContentProviderNative.java:557)
at android.content.ContentResolver.insert(ContentResolver.java:2200)
at android.content.ContentResolver.insert(ContentResolver.java:2162)
at android.app.DownloadManager.enqueue(DownloadManager.java:1582)
However, we are setting up the download like this:
val request = DownloadManager.Request(Uri.parse(downloadUrl))
.apply {
setDestinationInExternalPublicDir(Environment.DIRECTORY_DOWNLOADS, downloadFilename)
// ...
}
and, according to the docs of setDestinationInExternalPublicDir
no permission should be required.
Furthermore, I am getting crash reports from all kinds of different devices and on all recent Android versions – but I cannot reproduce it on any of my test devices, even though some are the exact same model/OS version combination that I also see in Crashlytics.
Is there any user setting that could be causing the trouble here?