hid-barcode-scanner icon indicating copy to clipboard operation
hid-barcode-scanner copied to clipboard

Improve error handling if ML Kit is not working?

Open szescxz opened this issue 11 months ago • 2 comments

I'm experiencing an issue when camera preview is working but the app could not recognize any barcodes. Until I checked the logcat:

03-06 19:33:29.098 30992   879 D BarcodeAnalyser: Processing image
03-06 19:33:29.100 30992  6018 W DynamiteModule: Local module descriptor class for com.google.mlkit.dynamite.barcode not found.
03-06 19:33:29.110 30992   879 E BarcodeAnalyser: Error waiting for task
03-06 19:33:29.110 30992   879 E BarcodeAnalyser: r6.a: Waiting for the barcode module to be downloaded. Please wait.
03-06 19:33:29.110 30992   879 E BarcodeAnalyser: 	at a7.l.c(Unknown Source:237)
03-06 19:33:29.110 30992   879 E BarcodeAnalyser: 	at b4.k0.run(Unknown Source:52)
03-06 19:33:29.110 30992   879 E BarcodeAnalyser: 	at l.h.run(Unknown Source:108)
03-06 19:33:29.110 30992   879 E BarcodeAnalyser: 	at f5.g.run(Unknown Source:28)
03-06 19:33:29.110 30992   879 E BarcodeAnalyser: 	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
03-06 19:33:29.110 30992   879 E BarcodeAnalyser: 	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
03-06 19:33:29.110 30992   879 E BarcodeAnalyser: 	at f5.g.run(Unknown Source:53)
03-06 19:33:29.110 30992   879 E BarcodeAnalyser: 	at java.lang.Thread.run(Thread.java:920)
03-06 19:33:29.111 30992 30992 E BarcodeAnalyser: Error processing image
03-06 19:33:29.111 30992 30992 E BarcodeAnalyser: r6.a: Waiting for the barcode module to be downloaded. Please wait.
03-06 19:33:29.111 30992 30992 E BarcodeAnalyser: 	at a7.l.c(Unknown Source:237)
03-06 19:33:29.111 30992 30992 E BarcodeAnalyser: 	at b4.k0.run(Unknown Source:52)
03-06 19:33:29.111 30992 30992 E BarcodeAnalyser: 	at l.h.run(Unknown Source:108)
03-06 19:33:29.111 30992 30992 E BarcodeAnalyser: 	at f5.g.run(Unknown Source:28)
03-06 19:33:29.111 30992 30992 E BarcodeAnalyser: 	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
03-06 19:33:29.111 30992 30992 E BarcodeAnalyser: 	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
03-06 19:33:29.111 30992 30992 E BarcodeAnalyser: 	at f5.g.run(Unknown Source:53)
03-06 19:33:29.111 30992 30992 E BarcodeAnalyser: 	at java.lang.Thread.run(Thread.java:920)
03-06 19:33:29.112 30992 30992 D BarcodeAnalyser: Image processed

The easiest workaround is to use the bundled version from GitHub release, but I expect the app to detect such errors and guide the user to do so.

szescxz avatar Mar 06 '24 16:03 szescxz

Thanks for the feedback and your interest in the app. Normally there should already be dialogs for notifying the user about the mlkit module. These should look like following:

However since this wasn't the case for you I will be looking into and see if I can improve this. If you still have the logcat available you could search for the tag "ModuleInstaller". There should be log outputs simmilar to the following:

11386-11386 ModuleInstaller dev.fabik.bluetoothhid D Checking if module is present 11386-11386 ModuleInstaller dev.fabik.bluetoothhid D Modules are not available 11386-11386 ModuleInstaller dev.fabik.bluetoothhid D Modules installer started 11386-11386 ModuleInstaller dev.fabik.bluetoothhid D Install state: 4 11386-11386 ModuleInstaller dev.fabik.bluetoothhid D Modules installation completed

Or if the installation failed:

11386-11386 ModuleInstaller dev.fabik.bluetoothhid D Checking if module is present 11386-11386 ModuleInstaller dev.fabik.bluetoothhid D Modules are not available 11386-11386 ModuleInstaller dev.fabik.bluetoothhid D Modules installer started 11386-11386 ModuleInstaller dev.fabik.bluetoothhid D Install state: 5 11386-11386 ModuleInstaller dev.fabik.bluetoothhid D Modules installation failed

Fabi019 avatar Mar 06 '24 18:03 Fabi019

Normally there should already be dialogs for notifying the user about the mlkit module. These should look like following:

I did see those after clearing Google Play Services data, but in some cases it just moved on after the "Please wait!" prompt, resulted in those logcat lines in the OP.

I'll do a full logcat again when I have time.

szescxz avatar Mar 07 '24 04:03 szescxz