You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
java.lang.IllegalArgumentException: Mutation of _data is not allowed.
at com.android.providers.media.MediaProvider.insertInternal(MediaProvider.java:5089)
at com.android.providers.media.MediaProvider.insert(MediaProvider.java:4973)
at android.content.ContentProvider$Transport.insert(ContentProvider.java:446)
at android.content.ContentProviderNative.onTransact(ContentProviderNative.java:180)
at android.os.Binder.execTransactInternal(Binder.java:1339)
at android.os.Binder.execTransact(Binder.java:1275)
**Expected Behavior**
After searching about this issue, I removed the following code
values.put(Images.Media.DATA, filePath);
in chart.java line 1572
Then the function worked and did not crash
It is said in the developer.android document :
> When you access an existing media file, you can use the value of the [DATA] column in your logic.
That's because this value has a valid file path. However, don't assume that the file is always available.
Be prepared to handle any file-based I/O errors that occur.
To create or update a media file, on the other hand, don't use the value of the DATA column.
Instead, use the values of the [DISPLAY_NAME]and [RELATIVE_PATH] columns.
**Possible Solution**
https://stackoverflow.com/a/61169612/7985871
https://developer.android.com/training/data-storage/shared/media
https://gist.github.com/RikkaW/0ae7f51117768a03c6581c956d75958c
**Device
Sumsung Galaxy S24 Ultra
and android emulator
![crashissue](https://github.com/user-attachments/assets/aed0c5c3-03c3-458a-b231-8b638bc58bee)
The text was updated successfully, but these errors were encountered:
emadPirayesh
changed the title
Calling chart1.saveToGallery() function in Android 14 causes Mutation of _data is not allowed exception to occur
Calling chart1.saveToGallery() function in Android 14 causes Mutation of _data is not allowed exception to occur
Nov 19, 2024
java.lang.IllegalArgumentException: Mutation of _data is not allowed.
at com.android.providers.media.MediaProvider.insertInternal(MediaProvider.java:5089)
at com.android.providers.media.MediaProvider.insert(MediaProvider.java:4973)
at android.content.ContentProvider$Transport.insert(ContentProvider.java:446)
at android.content.ContentProviderNative.onTransact(ContentProviderNative.java:180)
at android.os.Binder.execTransactInternal(Binder.java:1339)
at android.os.Binder.execTransact(Binder.java:1275)
The text was updated successfully, but these errors were encountered: