-
Notifications
You must be signed in to change notification settings - Fork 135
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
Android crashing on download on first time (java.lang.ArithmeticException: divide by zero) #164
Comments
Update - After digging a lot, it seems like on android the download is getting called twice somehow on the first run? That might be reason for the crash. As for the other times, I do not get logs 2 times and it does not crash as well. Is it a download manager issue? Is there a way to avoid this multiple calls? |
What size does the file you're downloading has? You could try to add a check here: react-native-blob-util/android/src/main/java/com/ReactNativeBlobUtil/ReactNativeBlobUtilReq.java Line 200 in 8edbfc8
E.g. by changing it to Please give me a quick hint if it helps or not. So we can dig further or create a fix |
Thanks for your kind response! The file size was not 0 for sure, it had few KB. I will add that check and give it a go today and will update you! |
@RonRadtke , I believe adding that check fixed the crash! I could not reproduce the same crash anymore! Would you be kind enough to release an update soon with this small fix? Thanks a lot! |
Yes I will. |
Having this strange issue on android that it is crashing when I try to download my remote PDF file first time. It downloads the file but then the app crashes. It only happens on the first run but on subsequent call it does not crash anymore. Please refer to the screenshot for the crash stack. I have been using BrowserStack devices.
This is my download file,
"react-native": "0.66.4",
"react-native-blob-util": "^0.16.0",
The text was updated successfully, but these errors were encountered: