Description
Describe the bug
The app crashes when we press the delete icon in the action bar inside any folder. I have observed that some files get deleted while some not. Also, there is no problem if one image is present.
To Reproduce
- Go to Gallery
- Click on any folder
- Click on delete icon on action bar
- App crashes
Expected behavior
All the photos should get deleted.
Logs
2020-01-16 14:52:41.181 11408-11901/org.fossasia.phimpme E/AndroidRuntime: FATAL EXCEPTION: AsyncTask 5
Process: org.fossasia.phimpme, PID: 11408
java.lang.RuntimeException: An error occurred while executing doInBackground()
at android.os.AsyncTask$3.done(AsyncTask.java:325)
at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:354)
at java.util.concurrent.FutureTask.setException(FutureTask.java:223)
at java.util.concurrent.FutureTask.run(FutureTask.java:242)
at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:243)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607)
at java.lang.Thread.run(Thread.java:760)
Caused by: io.realm.exceptions.RealmPrimaryKeyConstraintException: Primary key value already exists: /storage/emulated/0/.nomedia/IMG-20200116-WA0000.jpg .
(/Users/cm/Realm/realm-java-release/realm/realm-library/src/main/cpp/io_realm_internal_OsObject.cpp:237)
at io.realm.internal.OsObject.nativeCreateNewObjectWithStringPrimaryKey(Native Method)
at io.realm.internal.OsObject.createWithPrimaryKey(OsObject.java:202)
at io.realm.Realm.createObjectInternal(Realm.java:1049)
at io.realm.Realm.createObject(Realm.java:1024)
at org.fossasia.phimpme.gallery.activities.LFMainActivity.addTrashObjectsToRealm(LFMainActivity.java:3546)
at org.fossasia.phimpme.gallery.activities.LFMainActivity.access$4300(LFMainActivity.java:146)
at org.fossasia.phimpme.gallery.activities.LFMainActivity$1DeletePhotos.doInBackground(LFMainActivity.java:2159)
at org.fossasia.phimpme.gallery.activities.LFMainActivity$1DeletePhotos.doInBackground(LFMainActivity.java:2034)
at android.os.AsyncTask$2.call(AsyncTask.java:305)
at java.util.concurrent.FutureTask.run(FutureTask.java:237)
... 4 more
Screenshots
Smartphone Info:
Device: Redmi 4
Android Version: Android Nougat
Would you like to work on the issue?
- Yes
- No
- Other: