modernstorage
modernstorage copied to clipboard
IllegalArgumentException: Mutation of _data is not allowed when target Android 14
Describe the bug
I try use modernstorage to file downloading, but when update target to Android 14 start receive this exception
java.lang.IllegalArgumentException: Mutation of _data is not allowed.
at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:172)
at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:142)
at android.content.ContentProviderProxy.insert(ContentProviderNative.java:589)
at android.content.ContentResolver.insert(ContentResolver.java:2209)
at android.content.ContentResolver.insert(ContentResolver.java:2171)
at com.google.modernstorage.storage.AndroidFileSystem.createMediaStoreUri(AndroidFileSystem.kt:425)
Environment:
- Android OS version: Android 14
- Target SDK version API 34
- Device: Google Pixel 6a
- ModernStorage version: v1.0.0-alpha06
This is happening when saving my video file too.
ContentValues values = new ContentValues(4);
values.put(MediaStore.Video.Media.TITLE, video_id + ".mp4");
values.put(MediaStore.Video.Media.DISPLAY_NAME, video_id + ".mp4");
values.put(MediaStore.Video.Media.MIME_TYPE, "video/mp4");
values.put(MediaStore.Video.Media.DATA, new File(file_path).getAbsolutePath());
getContentResolver().insert(MediaStore.Video.Media.getContentUri(MediaStore.VOLUME_EXTERNAL_PRIMARY), values);
with the same stack trace.