Open RikdeVos opened 6 years ago
@RikdeVos That sounds really bad. Sorry for that. Unfortunately, I'm not able to look into this for the time being but seems like the error handling should be done better somehow. Any chance you could contribute on this? I'm happy to merge PRs or apply changes suggested and release a fixed version :)
@RoopeHakulinen Did some research on it, as this bug also infects my app. Seems like this is indeed happening when removing the tag during a (multi page) write. Always when it crashes, the java.lang.Exception is thrown, i think coming from line 47 in the MifareUltralight.java class.
Unfortunately, my Java/Android experience is too low to find a (good) solution for this. Could you by any chance collaborate with me to find a solution?
Hey @Robertbaelde! Unfortunately I don't have any Mifare Ultralight devices any more as I wrote the plugin for my old and not anymore maintained app. So there's not much I can do to debug the problem. I'm happy to help where ever I can (PRs, consultation, releasing a new version with specified changes) but can't do much of debugging by myself. Sorry :(
Hey @RikdeVos & @Robertbaelde we also faces the problem, but it happens quite randomly and very rarely, so we have serious issues to reproduce it. Do you know any case which would make crash NFC for sure ? Like this, I'll be able to debug it more easily !
@lonk We found that it occures the most when writing to the chip in parallel. We had some code that wrote all pages at once to the chip. When we refactored it, and write page for page the crashing reduced. But still once in a while it would crash. I think the issue must be some race condition. Scanning and removing the chip before write complete works best for us to recreate, but as you said. it's a rare bug, that triggers once in so-much tries.
After some investigations it appears that sometimes, NFC on Android is crashing, but restarts immediatly. We have to had a listener on the re-activation of NFC inside the plugin, and then call startNfc() (just as it's done in onResume()). I don't think I have the Java skills to do that, but I'll try in the next few days !
Hi @lonk , Any succes? Please let me know if there is something i can help with. (I also unfortunately don't have any significant java skills)
I put a bounty of 100$ on it for anyone that fixes this. https://www.bountysource.com/issues/55560848-nfc-crashes-on-android-after-mifare-write-fails-couple-of-times
Sometimes when quickly removing the mifare tag during writing, the write fails. When this happens 1-3 times in a row, NFC crashes on Android and we need to restart the device. Other apps using NFC are also not working.