I'm trying to implement Add a sticky label order printer on my App. I already have ORDER and RECEIPT printer integrations. For LABEL, I upgraded my Clover SDK to 262.2.
I'm attempting to print a test from the following code.
new AsyncTask<Void, Void, Printer>() { @Override protected Printer doInBackground(Void... params) { return getPrinter(Category.LABEL); } @Override protected void onPostExecute(Printer printer) { if (printer == null) { return; } if (mOrder != null) { List<String> itemIdList = Stream.of(mOrder.getLineItems()).map(lineItem -> lineItem.getId()).collect(Collectors.toList()); ArrayList<String> itemIds = new ArrayList<>(itemIdList); Log.d(TAG, "Printing Order Label"); StaticLabelPrintJob print_job = new StaticLabelPrintJob .Builder() .itemIds(itemIds) .markPrinted(true) .reprintAllowed(true) .build(); print_job.print(thisActivity, account, printer); } else { Log.d(TAG, "Order is null"); } } }.execute();
mOrder is of type Order from clover SDK. I'm trying to use StaticLabelPrintJob to invoke a print. I have already added my Label Printer as well (Epson TM-L90 PLUS).
When that code is executed, the Clover app crashes with the message "Clover has stopped". And in the print jobs queue, you can see the print job as an error.
On the logcat, I'm seeing the following:
2021-07-07 15:26:00.927 11928-12381/? E/AndroidRuntime: FATAL EXCEPTION: IntentService[com.clover.engine.printer.PrintService] Process: com.clover.engine, PID: 11928 java.lang.NullPointerException: Attempt to invoke virtual method 'boolean com.clover.sdk.v3.order.Order.isNotNullLineItems()' on a null object reference at com.clover.common2.orders.v3.OrderUtils.setLineItemsPrinted(OrderUtils.java:925) at com.clover.engine.printer.PrintService.doEnqueue(PrintService.java:177) at com.clover.engine.printer.PrintService.onHandleIntent(PrintService.java:139) at android.app.IntentService$ServiceHandler.handleMessage(IntentService.java:76) at android.os.Handler.dispatchMessage(Handler.java:106) at android.os.Looper.loop(Looper.java:164) at android.os.HandlerThread.run(HandlerThread.java:65)
And after this, even a Print Test Receipt doesn't work.
My DeviKit is a Clover Mini 2.
com.clover.engine versionCode: 2131 versionName: 2.0-2131
com.clover.printers versionCode: 1189 versionName: 1.0-1189
com.clover.epsonprinter versionCode: 16 versionName: 1.0-16
What is causing this? What am I doing wrong? I'll add the Order ID I tested with in the comments for the moderators. Thanks.