yasirkula / UnityNativeGallery

A native Unity plugin to interact with Gallery/Photos on Android & iOS (save and/or load images/videos)
MIT License
1.42k stars 199 forks source link

Crash in com.yasirkula.unity.NativeGalleryMediaPickerResultFragment #298

Closed laijingquan closed 1 year ago

laijingquan commented 1 year ago

Description of the bug

A clear and concise description of what the bug is. Before reporting a bug, please do a quick search in Issues to see if it is already reported. If the documentation has a FAQ (Frequently Asked Questions), please also check out the entries there.

Reproduction steps

If possible, providing reproduction steps would be very helpful while pinpointing the issue. You can also post screenshots if you think they would be helpful.

Platform specs

Please provide the following info if this is a Unity 3D repository.

Additional info Caused by java.lang.IllegalStateException Can not perform this action after onSaveInstanceState android.app.FragmentManagerImpl.checkStateLoss (FragmentManager.java:1870) android.app.FragmentManagerImpl.enqueueAction (FragmentManager.java:1893) android.app.BackStackRecord.commitInternal (BackStackRecord.java:688) android.app.BackStackRecord.commit (BackStackRecord.java:646) android.app.DialogFragment.dismissInternal (DialogFragment.java:304) android.app.DialogFragment.dismiss (DialogFragment.java:270) com.yasirkula.unity.NativeGalleryMediaPickerResultFragment$1.run (NativeGalleryMediaPickerResultFragment.java:35) android.os.Handler.handleCallback (Handler.java:789) android.os.Handler.dispatchMessage (Handler.java:98) android.os.Looper.loop (Looper.java:164) android.app.ActivityThread.main (ActivityThread.java:6944) java.lang.reflect.Method.invoke (Method.java) com.android.internal.os.Zygote$MethodAndArgsCaller.run (Zygote.java:327) com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1374)

yasirkula commented 1 year ago

Can you try updating the plugin from GitHub? The problematic line says dismissAllowingStateLoss but it was updated 6 months ago, so if your version is older you need to update: https://github.com/yasirkula/UnityNativeGallery/blob/c777ed2b916eed860bbab7dc9baf2bc422ec42ce/.github/AAR%20Source%20(Android)/java/com/yasirkula/unity/NativeGalleryMediaPickerResultFragment.java#L35

laijingquan commented 1 year ago

It seems that I was negligent. Thank you very much for your reply. I will update it immediately.