Android Question Problem with zBarcodeScanner

David Elkington

Active Member
Licensed User
Longtime User
I was wondering if anyone could help. I have been using a barcode scanner in my app for ages, but now all of a sudden, I get an error when trying to initiate a scan. I have the error below, does anyone have any idea what is missing?

When I step though the code line by line, it seems to work

zb1.Visible = True
zb1.startScanner(backCamId)
b1.Visible=True



** Activity (mainmenu) Pause, UserClosed = false **
** Activity (qrallocation) Create, isFirst = true **
frontCamId = 1
backCamId = 0
** Activity (qrallocation) Resume **
android.content.res.Resources$NotFoundException: Resource ID #0x0
at android.content.res.ResourcesImpl.getValue(ResourcesImpl.java:255)
at android.content.res.Resources.getValue(Resources.java:1353)
at android.content.res.HwResources.getColor(HwResources.java:280)
at android.content.res.Resources.getColor(Resources.java:961)
at main.java.me.dm7.barcodescanner.core.ViewFinderView.<init>(ViewFinderView.java:39)
at main.java.me.dm7.barcodescanner.core.BarcodeScannerView.createViewFinderView(BarcodeScannerView.java:57)
at main.java.me.dm7.barcodescanner.core.BarcodeScannerView.setupLayout(BarcodeScannerView.java:40)
at main.java.me.dm7.barcodescanner.core.BarcodeScannerView.setupCameraPreview(BarcodeScannerView.java:70)
at main.java.me.dm7.barcodescanner.core.CameraHandlerThread$1$1.run(CameraHandlerThread.java:31)
at android.os.Handler.handleCallback(Handler.java:761)
at android.os.Handler.dispatchMessage(Handler.java:98)
at android.os.Looper.loop(Looper.java:156)
at android.app.ActivityThread.main(ActivityThread.java:6523)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:941)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:831)
 

DonManfred

Expert
Licensed User
Longtime User
android.content.res.Resources$NotFoundException: Resource ID #0x0
There seems to be a missing Ressource which needs probably added by a #additionalres line.
 
Upvote 0

David Elkington

Active Member
Licensed User
Longtime User
There seems to be a missing Ressource which needs probably added by a #additionalres line.

Yes, there is one, which I added in Main, but why would it work when stepping through in debug mode line by line, but crash when compiled or in debug without a break point?
 
Upvote 0

David Elkington

Active Member
Licensed User
Longtime User
There isn't really anywhere for me to put in a Sleep when the camera opens. Only these two lines normally do the job.

zb1.Visible = True
zb1.startScanner(backCamId)
 
Upvote 0

Johan Schoeman

Expert
Licensed User
Longtime User
There isn't really anywhere for me to put in a Sleep when the camera opens. Only these two lines normally do the job.

zb1.Visible = True
zb1.startScanner(backCamId)
Do you have the folder with the resource files in your project? I guess you do if you say it worked before. Can you maybe send me your project so that I can see if I can get the same error on one of my devices? What android version is on your device?
 
Upvote 0

David Elkington

Active Member
Licensed User
Longtime User
I have just installed ZBAR onto my new tablet Android 7.0 and it crashes the same way as my program. I have installed the same demo onto an older tablet, (Android 5.0.1) and it worked. Do you think my version of zb is too old? Are there newer versions?
 
Upvote 0

Johan Schoeman

Expert
Licensed User
Longtime User
I have just installed ZBAR onto my new tablet Android 7.0 and it crashes the same way as my program. I have installed the same demo onto an older tablet, (Android 5.0.1) and it worked. Do you think my version of zb is too old? Are there newer versions?
I will have to see if anyone has reported any such issues with Android 7.0 in the original Github project and see if there are a suggested solution. I will see if my wife or my son has a 7.0 device (they change devices faster than what I can think...) and if so test it on one of their devices.

Not sure at this stage why it comes up with the Resource error on Android 7.0 and not on earlier versions of Android.....
 
Upvote 0

Johan Schoeman

Expert
Licensed User
Longtime User
Upvote 0

David Elkington

Active Member
Licensed User
Longtime User
That program runs fine on my 5.0.1 device, but when I put on Android 7, I get the big green button but clicking on it does nothing.
 
Upvote 0

David Elkington

Active Member
Licensed User
Longtime User
Sorry, just managed to press the button. It scans the code and then dies. You have to click the button top left for some reason
 
Upvote 0

David Elkington

Active Member
Licensed User
Longtime User
I remember why I did not use ZXing1 now, what ever value I had for timeout did not work, it just went straight to the timeout and stopped
 
Upvote 0

David Elkington

Active Member
Licensed User
Longtime User
I also tried to run the zxScannerLiveView and this was code directly from the download.

Logger connected to: HUAWEI BTV-DL09
--------- beginning of main
Copying updated assets files (1)
*** Service (starter) Create ***
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
Error occurred on line: 36 (Main)
android.content.res.Resources$NotFoundException: Resource ID #0x0
at android.content.res.ResourcesImpl.getValue(ResourcesImpl.java:255)
at android.content.res.Resources.loadXmlResourceParser(Resources.java:2187)
at android.content.res.Resources.getLayout(Resources.java:1178)
at android.view.LayoutInflater.inflate(LayoutInflater.java:424)
at android.view.LayoutInflater.inflate(LayoutInflater.java:377)
at eu.livotov.labs.android.camview.ScannerLiveView.initUI(ScannerLiveView.java:64)
at eu.livotov.labs.android.camview.ScannerLiveView.<init>(ScannerLiveView.java:59)
at zxscanwrapper.zxScanWrapper._initialize(zxScanWrapper.java:76)
at zxscanwrapper.zxScanWrapper.Initialize(zxScanWrapper.java:69)
at JHS.zxScannerLiveView.main._activity_create(main.java:381)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:710)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:342)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:249)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:139)
at JHS.zxScannerLiveView.main.afterFirstLayout(main.java:102)
at JHS.zxScannerLiveView.main.access$000(main.java:17)
at JHS.zxScannerLiveView.main$WaitForLayout.run(main.java:80)
at android.os.Handler.handleCallback(Handler.java:761)
at android.os.Handler.dispatchMessage(Handler.java:98)
at android.os.Looper.loop(Looper.java:156)
at android.app.ActivityThread.main(ActivityThread.java:6523)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:941)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:831)
** Activity (main) Resume **
*** Service (starter) Create ***
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
Error occurred on line: 36 (Main)
android.content.res.Resources$NotFoundException: Resource ID #0x0
at android.content.res.ResourcesImpl.getValue(ResourcesImpl.java:255)
at android.content.res.Resources.loadXmlResourceParser(Resources.java:2187)
at android.content.res.Resources.getLayout(Resources.java:1178)
at android.view.LayoutInflater.inflate(LayoutInflater.java:424)
at android.view.LayoutInflater.inflate(LayoutInflater.java:377)
at eu.livotov.labs.android.camview.ScannerLiveView.initUI(ScannerLiveView.java:64)
at eu.livotov.labs.android.camview.ScannerLiveView.<init>(ScannerLiveView.java:59)
at zxscanwrapper.zxScanWrapper._initialize(zxScanWrapper.java:76)
at zxscanwrapper.zxScanWrapper.Initialize(zxScanWrapper.java:69)
at JHS.zxScannerLiveView.main._activity_create(main.java:381)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:710)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:342)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:249)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:139)
at JHS.zxScannerLiveView.main.afterFirstLayout(main.java:102)
at JHS.zxScannerLiveView.main.access$000(main.java:17)
at JHS.zxScannerLiveView.main$WaitForLayout.run(main.java:80)
at android.os.Handler.handleCallback(Handler.java:761)
at android.os.Handler.dispatchMessage(Handler.java:98)
at android.os.Looper.loop(Looper.java:156)
at android.app.ActivityThread.main(ActivityThread.java:6523)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:941)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:831)
** Activity (main) Resume **
*** Service (starter) Create ***
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
Error occurred on line: 36 (Main)
android.content.res.Resources$NotFoundException: Resource ID #0x0
at android.content.res.ResourcesImpl.getValue(ResourcesImpl.java:255)
at android.content.res.Resources.loadXmlResourceParser(Resources.java:2187)
at android.content.res.Resources.getLayout(Resources.java:1178)
at android.view.LayoutInflater.inflate(LayoutInflater.java:424)
at android.view.LayoutInflater.inflate(LayoutInflater.java:377)
at eu.livotov.labs.android.camview.ScannerLiveView.initUI(ScannerLiveView.java:64)
at eu.livotov.labs.android.camview.ScannerLiveView.<init>(ScannerLiveView.java:59)
at zxscanwrapper.zxScanWrapper._initialize(zxScanWrapper.java:76)
at zxscanwrapper.zxScanWrapper.Initialize(zxScanWrapper.java:69)
at JHS.zxScannerLiveView.main._activity_create(main.java:381)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:710)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:342)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:249)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:139)
at JHS.zxScannerLiveView.main.afterFirstLayout(main.java:102)
at JHS.zxScannerLiveView.main.access$000(main.java:17)
at JHS.zxScannerLiveView.main$WaitForLayout.run(main.java:80)
at android.os.Handler.handleCallback(Handler.java:761)
at android.os.Handler.dispatchMessage(Handler.java:98)
at android.os.Looper.loop(Looper.java:156)
at android.app.ActivityThread.main(ActivityThread.java:6523)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:941)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:831)
** Activity (main) Resume **
*** Service (starter) Create ***
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
Error occurred on line: 36 (Main)
android.content.res.Resources$NotFoundException: Resource ID #0x0
at android.content.res.ResourcesImpl.getValue(ResourcesImpl.java:255)
at android.content.res.Resources.loadXmlResourceParser(Resources.java:2187)
at android.content.res.Resources.getLayout(Resources.java:1178)
at android.view.LayoutInflater.inflate(LayoutInflater.java:424)
at android.view.LayoutInflater.inflate(LayoutInflater.java:377)
at eu.livotov.labs.android.camview.ScannerLiveView.initUI(ScannerLiveView.java:64)
at eu.livotov.labs.android.camview.ScannerLiveView.<init>(ScannerLiveView.java:59)
at zxscanwrapper.zxScanWrapper._initialize(zxScanWrapper.java:76)
at zxscanwrapper.zxScanWrapper.Initialize(zxScanWrapper.java:69)
at JHS.zxScannerLiveView.main._activity_create(main.java:381)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:710)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:342)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:249)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:139)
at JHS.zxScannerLiveView.main.afterFirstLayout(main.java:102)
at JHS.zxScannerLiveView.main.access$000(main.java:17)
at JHS.zxScannerLiveView.main$WaitForLayout.run(main.java:80)
at android.os.Handler.handleCallback(Handler.java:761)
at android.os.Handler.dispatchMessage(Handler.java:98)
at android.os.Looper.loop(Looper.java:156)
at android.app.ActivityThread.main(ActivityThread.java:6523)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:941)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:831)
** Activity (main) Resume **
 
Upvote 0

David Elkington

Active Member
Licensed User
Longtime User
I have even tried creating the project from scratch and I still get the above error. It only happens when it is running straight through. When I run it in debug with a break point on the startscanner, it works ok by stepping through. I have tried putting a sleep 2000 in just after the startscanner, but it bombs out before it gets there. I am completely stuck, not sure what to do next, any suggestions?
 
Upvote 0

Johan Schoeman

Expert
Licensed User
Longtime User
I have even tried creating the project from scratch and I still get the above error. It only happens when it is running straight through. When I run it in debug with a break point on the startscanner, it works ok by stepping through. I have tried putting a sleep 2000 in just after the startscanner, but it bombs out before it gets there. I am completely stuck, not sure what to do next, any suggestions?
I don't know the answer to this at present....what android version have your b4A been set up to make use of? 25? 23? Have you tried it to see if it makes a difference?
 
Upvote 0

David Elkington

Active Member
Licensed User
Longtime User
I was on 25 of the SDK, I am now on 26. Updating had no effect. I have restored a version of my app (just the apk) and installed it on the tablet and that works fine. So definitely something to do with the app rather than the tablet.

Are there any clues in the Java lines that it is failing on?
 
Upvote 0

Johan Schoeman

Expert
Licensed User
Longtime User
I was on 25 of the SDK, I am now on 26. Updating had no effect. I have restored a version of my app (just the apk) and installed it on the tablet and that works fine. So definitely something to do with the app rather than the tablet.

Are there any clues in the Java lines that it is failing on?
If I look at your log that you have posted it does not load/see the resources. Just to get on the same page - please post e link to the library that you are trying to use. Is it the ZBAR barcode scanner?
 
Upvote 0
Top