Android Question Bar Code reader (which is latest/easiest)

Tony Tetley

Active Member
Licensed User
Longtime User
After searching the forums for bar code readers I found 2 sample apps but neither of them work. One shows the bar code in the viewer but never captures, and the other shows crashes (log shown below). Suggestions would be appreciated.

Copying updated assets files (1)
** Activity (main) Create (first time) **
** Activity (main) Resume **
** Activity (main) Pause event (activity is not paused). **
java.lang.NoClassDefFoundError: Failed resolution of: Landroidx/arch/core/executor/ArchTaskExecutor;
at androidx.lifecycle.LifecycleRegistry_androidKt.isMainThread(LifecycleRegistry.android.kt:23)
at androidx.lifecycle.LifecycleRegistry.enforceMainThreadIfNeeded(LifecycleRegistry.jvm.kt:297)
at androidx.lifecycle.LifecycleRegistry.addObserver(LifecycleRegistry.jvm.kt:172)
at androidx.activity.ComponentActivity.<init>(ComponentActivity.kt:256)
at com.google.mlkit.vision.codescanner.internal.GmsBarcodeScanningDelegateActivity.<init>(com.google.android.gms:play-services-code-scanner@@16.1.0:1)
at java.lang.Class.newInstance(Native Method)
at android.app.AppComponentFactory.instantiateActivity(AppComponentFactory.java:95)
at android.app.Instrumentation.newActivity(Instrumentation.java:1328)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:4038)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:4325)
at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:101)
at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2574)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loopOnce(Looper.java:226)
at android.os.Looper.loop(Looper.java:313)
at android.app.ActivityThread.main(ActivityThread.java:8762)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:604)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1067)
Caused by: java.lang.ClassNotFoundException: androidx.arch.core.executor.ArchTaskExecutor
... 21 more
 

DonManfred

Expert
Licensed User
Longtime User
Searching for the error suggests to install the newest SDK and IDE.

ARE your IDE and SDK uptodate?
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
What is the limit ?
512kb. Export the project as ZIP and the size will be OK. For APKs: ZIP them and use Dropbox or similar to store them.

BTW: It does not help to use your APK. The User in #1 need to have the newest SDK and IDE installed.
 
Upvote 0

sirjo66

Well-Known Member
Licensed User
Longtime User
512kb. Export the project as ZIP and the size will be OK. For APKs: ZIP them and use Dropbox or similar to store them.
Yes, I used Ctrl+Click on link
Ctrl + click to export as zip: ide://run?File=%B4X%\Zipper.jar&Args=GoogleCodeScanner.zip
 
Upvote 0

Tony Tetley

Active Member
Licensed User
Longtime User

Attachments

  • Scanerror.png
    Scanerror.png
    36.6 KB · Views: 22
Upvote 0

Peter Simpson

Expert
Licensed User
Longtime User
The example in your link is the one that opens the camera but never captures
B4A IDE is 14.00
Samsung Galaxy S20
I've just tested that link, in ran the code, I clicked start, pointed it to my business card that has a SQ Code at the back, it showed my url address. So it's working here. It ran as is, I than removed the starter module and updated the manifest to target 36, and it still worked.

Pixel 10 Pro XL running Android 17.
 
Upvote 0

Tony Tetley

Active Member
Licensed User
Longtime User
Try this example: https://www.sirjo.com/GoogleCodeScanner.zip

For @Erel and all:
I tried to upload this ZIP file as an attachment on this post, but it tell me that the file is too large for upload.
It is only 795 KB
What is the limit ?
This example worked. I thought it was the same as the one I previously downloaded, but I tried it anyway and it worked. Must be a newer version.

Thanks to all for the help.
 
Upvote 0
Top