anggastudio/Printama

System.err: java.io.IOException: Broken pipe

Closed this issue · 1 comments

My old application is dependent on this library, but since some time it showing error and worked now , The bluetooth printer is connected fine but not print the receipt, the every function of printer util like printtext, printline etc. I cloned the printama android demo project and showing same error. so Please resolve this issue.

Here is the Android logs:-

2023-06-05 19:00:30.583 18376-18376/com.anggastudio.sample W/System.err: java.io.IOException: Broken pipe
2023-06-05 19:00:30.584 18376-18376/com.anggastudio.sample W/System.err: at android.net.LocalSocketImpl.writeba_native(Native Method)
2023-06-05 19:00:30.584 18376-18376/com.anggastudio.sample W/System.err: at android.net.LocalSocketImpl.access$500(LocalSocketImpl.java:37)
2023-06-05 19:00:30.584 18376-18376/com.anggastudio.sample W/System.err: at android.net.LocalSocketImpl$SocketOutputStream.write(LocalSocketImpl.java:144)
2023-06-05 19:00:30.584 18376-18376/com.anggastudio.sample W/System.err: at android.bluetooth.BluetoothSocket.write(BluetoothSocket.java:786)
2023-06-05 19:00:30.584 18376-18376/com.anggastudio.sample W/System.err: at android.bluetooth.BluetoothOutputStream.write(BluetoothOutputStream.java:79)
2023-06-05 19:00:30.584 18376-18376/com.anggastudio.sample W/System.err: at java.io.OutputStream.write(OutputStream.java:122)
2023-06-05 19:00:30.584 18376-18376/com.anggastudio.sample W/System.err: at com.anggastudio.printama.PrinterUtil.printUnicode(PrinterUtil.java:94)
2023-06-05 19:00:30.585 18376-18376/com.anggastudio.sample W/System.err: at com.anggastudio.printama.PrinterUtil.addNewLine(PrinterUtil.java:166)
2023-06-05 19:00:30.585 18376-18376/com.anggastudio.sample W/System.err: at com.anggastudio.printama.PrinterUtil.feedPaper(PrinterUtil.java:290)
2023-06-05 19:00:30.585 18376-18376/com.anggastudio.sample W/System.err: at com.anggastudio.printama.Printama.feedPaper(Printama.java:184)
2023-06-05 19:00:30.585 18376-18376/com.anggastudio.sample W/System.err: at com.anggastudio.printama.Printama.lambda$printTest$2(Printama.java:127)
2023-06-05 19:00:30.585 18376-18376/com.anggastudio.sample W/System.err: at com.anggastudio.printama.-$$Lambda$Printama$RmuijsPIw_E46bsFguHyZkOvvNI.onConnected(Unknown Source:0)
2023-06-05 19:00:30.585 18376-18376/com.anggastudio.sample W/System.err: at com.anggastudio.printama.Printama.lambda$connect$0$Printama(Printama.java:102)
2023-06-05 19:00:30.585 18376-18376/com.anggastudio.sample W/System.err: at com.anggastudio.printama.-$$Lambda$Printama$8huuBLTLR2MZ4RxuJjF9x13epEw.onConnected(Unknown Source:4)
2023-06-05 19:00:30.585 18376-18376/com.anggastudio.sample W/System.err: at com.anggastudio.printama.PrinterUtil$1.onConnected(PrinterUtil.java:63)
2023-06-05 19:00:30.585 18376-18376/com.anggastudio.sample W/System.err: at com.anggastudio.printama.PrinterUtil$ConnectAsyncTask.onPostExecute(PrinterUtil.java:327)
2023-06-05 19:00:30.585 18376-18376/com.anggastudio.sample W/System.err: at com.anggastudio.printama.PrinterUtil$ConnectAsyncTask.onPostExecute(PrinterUtil.java:294)
2023-06-05 19:00:30.585 18376-18376/com.anggastudio.sample W/System.err: at android.os.AsyncTask.finish(AsyncTask.java:771)
2023-06-05 19:00:30.586 18376-18376/com.anggastudio.sample W/System.err: at android.os.AsyncTask.access$900(AsyncTask.java:199)
2023-06-05 19:00:30.586 18376-18376/com.anggastudio.sample W/System.err: at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:788)
2023-06-05 19:00:30.586 18376-18376/com.anggastudio.sample W/System.err: at android.os.Handler.dispatchMessage(Handler.java:106)
2023-06-05 19:00:30.586 18376-18376/com.anggastudio.sample W/System.err: at android.os.Looper.loopOnce(Looper.java:226)
2023-06-05 19:00:30.586 18376-18376/com.anggastudio.sample W/System.err: at android.os.Looper.loop(Looper.java:313)
2023-06-05 19:00:30.586 18376-18376/com.anggastudio.sample W/System.err: at android.app.ActivityThread.main(ActivityThread.java:8751)
2023-06-05 19:00:30.586 18376-18376/com.anggastudio.sample W/System.err: at java.lang.reflect.Method.invoke(Native Method)
2023-06-05 19:00:30.586 18376-18376/com.anggastudio.sample W/System.err: at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:571)
2023-06-05 19:00:30.586 18376-18376/com.anggastudio.sample W/System.err: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1135)

Screenshot_3

Please use the 0.9.73 version for Android 13 and above

java 17
min SDK 19
Bluetooth permission handler please see the sample app