New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Many of my android users report me this error - An unexpected error has occurred #188
Comments
Hi @alexislg2 👋 👩🏫 More detailed debugging information is needed.Please collect as much of the following data as possible when that error occurs.
When the error becomes reproducible, please submit a Bug Report Issue. Thanks💚 |
OK, I don't know yet how to collect that because as I said, I don't have the errors. Only a couple of users reported this to me and sent me the screenshot. I might try with crashalytics |
I finally managed to get some stacktrace from crashlytics:
|
OK. but there doesn't seem to be any logs that might help identify the cause of the error. Did you get the And if you get more than one error, Or is this reproducible? |
By the way, does the 'sending.image' have the correct url value in it? |
OK I will release a new version of my app, with more detailed logs in the crashlytics and wait for new logs to come... This is 100% reproductible. The users who have this error have it 100% of the times, with 100% of the photos they try with. |
Solved: the problem was caused by the destination file name: Some rare android devices were not able to overwrite it if a file with a similar name already exists in the album. new code for downloading:
|
And by the way, with my original code, the file was named |
I'm glad you were able to resolve the issue 😊 @alexislg2
Is this not album but directory ? This has nothing to do with the gallery, right? |
Downloading a file to the temporary folder if a file already exists was not the issue. The error was raised when trying to save it to the album (only with some devices again):
|
You might consider to update your README. I can make a PR if you like |
Was this caused by a duplicate dot in the extension? |
I cannot say and I cannot make any test (that would require to push a buggy version of the app in production). According to the error message, I would say it comes from the duplicate Nevertheless, it's not a good thing to use the same file name as prevent from having multiple photos in the albul |
The MediaStore API and custom java code should avoid duplicates, so duplicate filenames should not be the cause of the error. Perhaps the file system did not recognize the file correctly because of the two dots in the file extension. |
📝NoteI now know what the "Failed to build unique file" error message means.If you try to save a file with a duplicate name, the system avoids this automatically. This is of the form "file(1).jpg". At this time, the system will probably separate the name from the extension by the position of the dot in the extension to generate a unique name. That's why it became such an error when there were two extension dots, as in this case. |
I have encountered this same error. In my case I use I think I'll need to write image to temporary dir with mine own generated name and only then use |
Please consider submitting an issue that includes reproducible code. Without it, I can do nothing. |
Descrpition
I use gal 2.2.0 with flutter 3.16.4
I use gal to save photos downloaded from the internet. I have tried my app on several different phones and it works nicely. Unfortunately, at least 3 of my users experience this error "An unexpected error has occurred"
Here is my code:
I have no idea how to debug this
The text was updated successfully, but these errors were encountered: