newlogic/smartscanner-capacitor

Attempting to scan NFC or barcode causes Android app to crash

spencerAEE opened this issue · 8 comments

Current Behaviour

React Capacitor app consistently crashes after attempting to scan NFC or barcodes using the examples provided. With NFC it just immediately crashes even if no tags are near and for barcode it crashes as soon as the camera detects a barcode.

Expected Behaviour

App should not crash and NFC tags/barcodes should be scanned.

Steps to Reproduce the Problem

  1. Create project with boilerplate code for NFC and barcode
  2. Build APK and install on Android device
  3. Attempt to scan items

Context

Samsung S9, Android 10, Android Studio 2022.1.1 (Electric Eel), Gradle 7.4.1

  • Version: 0.5.0-beta.9
  • Platform: Android
  • Capacitor version: 4.6.3

Still having trouble with this. Not sure how relevant this is but if I run the code on browser, the functions return undefined. I assume that's just because there's no NFC hardware to access from the browser but I still felt it was worth pointing out in case it could help lead to the source of the issue.

Also worth noting is this error message that comes up when I try to trigger a scan in the emulator. It looks as though there could be a problem with the MRZ library, and even though I'm not even trying to use MRZ that's still having an impact.

emulator_error

Hi @spencerAEE what @idpass/smartscanner-capacitor version are you using? Also, do you have the necessary .aar files? If yes, can you give me the link where you downloaded it?

I am using the most current release on Node, which is 0.5.0-beta.9. As for the required .aar files, they are actually in this repository under the android directory, although I plan on attempting to rebuild them and fix the error noted above.

I think I have experienced that before. If my memory serves me right, the cause of that error is using different .aar file. Are you using these files?

I'll be honest, I ended up just moving the project to React Native and using their NFC management plugin instead as it provides more features and stability out of the box. That being said, I still want to keep experimenting with this in my free time.

Hello @spencerAEE Thank you for creating this Ticket.

We will need to investigate this further.

@spencerAEE @nicholemnl this crash concerning NoSuchMethodError could mean that MLKit library is not present when you built the APK wtih the capacitor plugin.

This probably could be due to a number of things but from my experience I think it may be due to:

Hope this helps. 🙏🏻