shangmisunmi / SunmiPrinterDemo

printer test demo
287 stars 137 forks source link

Printer Service has stopped #10

Open AvroNill opened 5 years ago

AvroNill commented 5 years ago

Unfortunately, Printer Service has stopped.

Project: SunmiPrinterDemoV1 Connection: AIDL Text Test > Print > Crash

10-31 17:23:45.500 20435-20458/? E/AndroidRuntime: FATAL EXCEPTION: pool-1-thread-1 Process: woyou.aidlservice.jiuiv5, PID: 20435 java.lang.NullPointerException: name is null at android.content.res.Resources.getIdentifier(Resources.java:2267) at com.woyou.ui.FontSourceProcessor.process(FontSourceProcessor.java:74) at com.woyou.ui.EasyFonts.getTypefaceByName(EasyFonts.java:40) at com.woyou.ui.PrinterSet.setTypeface(PrinterSet.java:120) at com.woyou.ui.BitmapCreator.printText(BitmapCreator.java:350) at com.sunmi.commandbean.StringCommand.run(StringCommand.java:89) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587) at java.lang.Thread.run(Thread.java:818)

AvroNill commented 5 years ago

I have solved the Issue: AidlUtil.class line 240

woyouService.printTextWithFont(content, null, size, null);

change to

woyouService.printTextWithFont(content, "utf-8", size, null);