Closed Jopie01 closed 1 year ago
Thanks for checking this out, I was only working on the iOS implementation and have not tested the Android implementation fully, but I will have a look at this one. I am not really sure what exactly is happening here, it looks like some references are destroyed to early or something...
The docs will be updated once the new version is ready :)
Thanks for looking into it. I also did some digging and when I moved the line https://github.com/capacitor-community/barcode-scanner/blob/ml-kit/android/src/main/java/com/getcapacitor/community/barcodescanner/CapacitorCommunityBarcodeScanner.java#L214 to line 225 I was able to scan multiple times without crashing.
So it seems that there is a collision in the scan results.
@Jopie01 @thegnuu Is this still an issue? I'm also testing with the ml-kit branch but I don't have any crashes.
@JanMisker, I had this crash when the scanner detected a barcode and called my callback function. In that function I stop the scanner and the next time I start scanning and detect a barcode the app crashes. With continuous scanning I hadn't any problem.
@Jopie01 check; I use continues scanning only, and then pause while processing and showing feedback to the user.
Note that on Android the pause()
didn't do anything, but a PR that fixes that was just merged an hour ago.
Should be fixed :)
Describe the bug I'm testing out the ml-kit branch to see how fast it is compared with the current scanner and I'm impressed how well it works. I mostly wanted to scan the DataMatrix 2D barcode and it doesn't matter how I hold the camera, it will be detected fast.
However, I had some trouble to get going because documentation wasn't up to date, but I got it working eventually. But then I ran into a fatal error in Android Studio when running the app on my phone:
This error occurs when I want to start scanning for the second time.
To Reproduce The app is an extreme basic app build on top of EmberJS and using ember-cli-capacitor to get everything in shape. But I suspect you can convert this into plain Javascript.
The code:
So when you press the Start button, the camera shows up and you can start scanning. After a barcode is scanned, the result is returned to the app using the
callback
function. The camera is then switched off and the app shows the scanned result.Press the Start button again and scan another or the same barcode. When the barcode is scanned the app crashes with the fatal error shown above.
Expected behavior We should be able to scan multiple times without crashing.
Smartphone (please complete the following information):
Additional context I think I'm missing something here which is letting the app crash.