ODK Printing with Zebra - xlsform coding

Hello Everyone,

Has anyone tried using ZD420 zebra printers to print directly from odk collect? I tried, the printer is connected but doesnt respond to print.

John

I tried only iMZ220
It's difficult to say if it's a problem with that printer or our app, because the app is not actively maintained and from my experience I know it wasn't easy to use.

Hi,
I use odk collect to print directly using ZQ520 printer.
The error I get is 'unfortunately, odk zebra printer has stopped'

My guess is that the problem is with the ODK sensors frameworks since immediately you tap on print, you are taken back to 'initiate printing'
Bests,
Margaret

Hi @Margaret_Wambui
I tested printing in ODK some time ago and also noticed some issues. Tomorrow I'll try to do that again and maybe I will be able to help you.

1 Like

I was able to reproduce the issue. Here is the stacktrace:

  java.lang.NoClassDefFoundError: Failed resolution of: Landroidx/core/app/ActivityCompat;
        at org.opendatakit.utilities.RuntimePermissionUtils.checkSelfAllPermission(RuntimePermissionUtils.java:34)
        at org.opendatakit.sensors.ui.activity.AddSensorActivity.onCreate(AddSensorActivity.java:60)
        at android.app.Activity.performCreate(Activity.java:6289)
        at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1119)
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2655)
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2767)
        at android.app.ActivityThread.access$900(ActivityThread.java:177)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1449)
        at android.os.Handler.dispatchMessage(Handler.java:102)
        at android.os.Looper.loop(Looper.java:145)
        at android.app.ActivityThread.main(ActivityThread.java:5951)
        at java.lang.reflect.Method.invoke(Native Method)
        at java.lang.reflect.Method.invoke(Method.java:372)
        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1400)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1195)
     Caused by: java.lang.ClassNotFoundException: Didn't find class "androidx.core.app.ActivityCompat" on path: DexPathList[[zip file "/system/framework/com.android.future.usb.accessory.jar", zip file "/data/app/org.opendatakit.sensors-1/base.apk"],nativeLibraryDirectories=[/vendor/lib, /system/lib]]
        at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:469)
        at org.opendatakit.utilities.RuntimePermissionUtils.checkSelfAllPermission(RuntimePermissionUtils.java:34) 
        at org.opendatakit.sensors.ui.activity.AddSensorActivity.onCreate(AddSensorActivity.java:60) 
        at android.app.Activity.performCreate(Activity.java:6289) 
        at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1119) 
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2655) 
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2767) 
        at android.app.ActivityThread.access$900(ActivityThread.java:177) 
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1449) 
        at android.os.Handler.dispatchMessage(Handler.java:102) 
        at android.os.Looper.loop(Looper.java:145) 
        at android.app.ActivityThread.main(ActivityThread.java:5951) 
        at java.lang.reflect.Method.invoke(Native Method) 
        at java.lang.reflect.Method.invoke(Method.java:372) 
        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1400) 
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1195) 
    	Suppressed: java.lang.ClassNotFoundException: androidx.core.app.ActivityCompat
        at java.lang.Class.classForName(Native Method)
        at java.lang.BootClassLoader.findClass(ClassLoader.java:781)
        at java.lang.BootClassLoader.loadClass(ClassLoader.java:841)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:504)

I think this pr will fix the problem https://github.com/opendatakit/sensorsframework/pull/44/
@W_Brunette could you confirm?

1 Like

Thanks @Grzesiek2010
Could you kindly build an apk?
Thank you

I can't. You have to wait for that pr and next release.

I will look into the this and put out hopefully an updated apk in 24-48 hours.

1 Like

Version 2.1.4 ALPHA of Sensors Framework and Zebra printer drivers have been release to the Play store.

Let us know if you have further issues.

1 Like

Thank you @W_Brunette
I have now tested the apps and attached is a screen record of the behavior on my phone.
On the printer, the Bluetooth icon comes up and I assume a connection has been established but nothing prints out.

odkprinting.zip (3.8 MB)

Thanks,
Margaret

To confirm you have both Sensors Framework and the Zebra printer driver installed? It requires both to work.

Also simply try launching the Zebra printer driver from the list of apps. Does that work?

I tested having both Sensors frameworks and Zebra printer driver installed.
By launching only the Zebra printer driver, the printer lights up with a Bluetooth icon. To print some barcode, I launch ODK collect try printing and nothing print's out. The behavior is as the previously uploaded screen recording.
Thanks

@Margaret_Wambui, to try to help us narrow down the issue. Can you try printing using the example/standard "widgets" xform?

1 Like

Using the example print widget provided, the application does not crash and neither print. The bluetooth icon comes up in the printer but nothing prints out.

I didn't test much but tracking down the crash @Margaret_Wambui mentioned as I remember I experienced the same.

Could it it's not printing because the sensors from play store are ODK-X sensors? you see it once you have installed.
Thanks

The ODK-X should not be a problem, it's just part of a naming change.

What version of printer are you using? The exact zebra number. I will see if I can track one down and test with the same printer model.

1 Like

its a Zebra ZQ520 model

Any progress?
Thanks

I have not been able to track down a a ZQ520 printer. An alternative could be that you private message me your form that you are trying to print and I can try it on the test printer I have.