I'm trying to print from my app to a wifi printer. I use the wifipt library. When I run the app in "debug" mode it prints correctly, but when I run the app in "release" mode the app gives an error.
Has anyone worked with wifi printers and can you give me some solution?
main_button2_click (java line: 361)
android.os.NetworkOnMainThreadException
at android.os.StrictMode$AndroidBlockGuardPolicy.onNetwork(StrictMode.java:1303)
at java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:111)
at java.net.SocketOutputStream.write(SocketOutputStream.java:145)
at com.zj.wfsdk.WifiCommunication.sndByte(WifiCommunication.java:90)
at cn.com.zj.zjwfprinter.PrintDemo.SendDataByte(PrintDemo.java:989)
at cn.com.zj.zjwfprinter.PrintDemo.Printreset(PrintDemo.java:1223)
at b4a.example.main._button2_click(main.java:361)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:186)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:170)
at anywheresoftware.b4a.BA.raiseEvent(BA.java:166)
at anywheresoftware.b4a.objects.ViewWrapper$1.onClick(ViewWrapper.java:80)
at android.view.View.performClick(View.java:6199)
at android.widget.TextView.performClick(TextView.java:11090)
at android.view.View$PerformClick.run(View.java:23647)
at android.os.Handler.handleCallback(Handler.java:751)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6682)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1520)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1410)