我在我的Android Studio 0.8.9项目中实现了Brother QL-710W android SDK。我可以通过Wifi连接到打印机,但是当想要打印时,我收到以下错误:
10-24 14:08:03.809 11202-11368/android.mobile.battlehack.com.arrived D/dalvikvm﹕ Trying to load lib /data/app-lib/android.mobile.battlehack.com.arrived-1/libcreatedata.so 0x42283230
10-24 14:08:03.809 11202-11368/android.mobile.battlehack.com.arrived D/dalvikvm﹕ Added shared lib /data/app-lib/android.mobile.battlehack.com.arrived-1/libcreatedata.so 0x42283230
10-24 14:08:03.809 11202-11368/android.mobile.battlehack.com.arrived D/dalvikvm﹕ No JNI_OnLoad found in /data/app-lib/android.mobile.battlehack.com.arrived-1/libcreatedata.so 0x42283230, skipping init
10-24 14:08:04.810 11202-11202/android.mobile.battlehack.com.arrived I/arrived.arrived﹕ errorCode = ERROR_WRONG_LABEL
10-24 14:08:04.810 11202-11202/android.mobile.battlehack.com.arrived I/arrived.arrived﹕ labelWidth = 29
10-24 14:08:04.810 11202-11202/android.mobile.battlehack.com.arrived I/arrived.arrived﹕ paperWidth = 29.0
10-24 14:08:04.810 11202-11202/android.mobile.battlehack.com.arrived I/Choreographer﹕ Skipped 59 frames! The application may be doing too much work on its main thread.
我的代码如下:
public void printLabel(View view) {
Printer myPrinter = new Printer();
PrinterInfo myPrinterInfo = new PrinterInfo();
try {
myPrinterInfo.printerModel = PrinterInfo.Model.QL_710W;
myPrinterInfo.ipAddress = mNetPrinter[0].ipAddress;
myPrinterInfo.macAddress = mNetPrinter[0].macAddress;
myPrinterInfo.port = PrinterInfo.Port.NET;
myPrinterInfo.paperSize = PrinterInfo.PaperSize.CUSTOM;
myPrinterInfo.printMode=PrinterInfo.PrintMode.FIT_TO_PAGE;
LabelInfo labelInfo = new LabelInfo();
labelInfo.labelNameIndex = 4;//LabelInfo.PT.valueOf("W24").ordinal();
labelInfo.isAutoCut = true;
labelInfo.isEndCut = true;
labelInfo.isHalfCut = false;
labelInfo.isSpecialTape = false;
myPrinter.setPrinterInfo(myPrinterInfo);
myPrinter.setLabelInfo(labelInfo);
File downloadFolder = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS);
Log.i(TAG, "startCommunication = " + myPrinter.startCommunication());
//myPrinter.printPDF(downloadFolder.getAbsolutePath() + File.separator + "100.pdf", 1);
Boolean val = myPrinter.startPTTPrint(1, null);
myPrinter.replaceText("Mark Thien");
myPrinter.endCommunication();
Log.i(TAG, "val = " + val);
Log.i(TAG, "errorCode = " + myPrinter.getPrinterStatus().errorCode);
Log.i(TAG, "labelWidth = " + myPrinter.getLabelParam().labelWidth);
Log.i(TAG, "paperWidth = " + myPrinter.getLabelParam().paperWidth);
} catch(Exception e){
e.printStackTrace();
}
}
我尝试了以下网址,但仍然收到错误:
ERROR_WRONG_LABEL when trying to print wireless using Android Brother Sdk for label printer
我把libAndrJFPDFEMB.so& libcreatedata.so进入src / main / jniLibs / armeabi /文件夹
感谢任何人的帮助。
标记