Cannot get ZebraPrinterLinkOs on Android in release

J Joanna Kozieł 4 days ago
10 0 0

Hi,

I created an app, that prints a label from an Android device on a Zebra Printer using Bluetooth. It works fine when debuging app but when I create a release apk file and install it on the device, the app crashes when trying to get ZebraPrinterLinkOs object, which I need to set the label length. This is the code I use for that:

Connection thePrinterConn = new BluetoothConnectionInsecure(printerMacAddress);

Looper.prepare();

thePrinterConn.open();

ZebraPrinterLinkOs linkOsPrinter = ZebraPrinterFactory.getLinkOsPrinter(thePrinterConn);

linkOsPrinter.setSetting("zpl.label_length", labelLength);

Because the issue occurs only in release build and the app itself is created using Flutter and not native Android, I have very limited logs from the moment of the crash. But what I have is:

E/AndroidRuntime(11406): FATAL EXCEPTION: Thread-6 E/AndroidRuntime(11406): Process: [app_package_name], PID: 11406 E/AndroidRuntime(11406): java.lang.ExceptionInInitializerError E/AndroidRuntime(11406):        at a3.s.<clinit>(SourceFile:16) E/AndroidRuntime(11406):        at com.google.android.gms.internal.mlkit_vision_barcode_bundled.c.b(SourceFile:1) E/AndroidRuntime(11406):        at q6.a.c(SourceFile:81) E/AndroidRuntime(11406):        at n3.o.m(SourceFile:111) E/AndroidRuntime(11406):        at n3.o.i(SourceFile:32) E/AndroidRuntime(11406):        at t2.a.run(SourceFile:27) E/AndroidRuntime(11406):        at java.lang.Thread.run(Thread.java:1012) E/AndroidRuntime(11406): Caused by: java.lang.NullPointerException: Attempt to invoke interface method 'u2.f u2.g.getterVisibility()' on a null object reference E/AndroidRuntime(11406):        at i3.u.<init>(SourceFile:2) E/AndroidRuntime(11406):        at i3.u.<clinit>(SourceFile:1) E/AndroidRuntime(11406):        ... 7 more

Because it works in debug build I cannot think about anything I can do to fix it. Unless there is some configuration that needs to be done specifically for release but it's not mentioned in the official docs.

CONTACT
Can’t find what you’re looking for?