0

我正在将 Brother QL-710W android SDK 实施到我的 Android Studio 0.8.9 项目中。我可以通过 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();

}

}

我尝试了以下网址,但仍然出现错误:

尝试使用用于标签打印机的 Android Brother Sdk 进行无线打印时出现 ERROR_WRONG_LABEL

我已将 libAndrJFPDFEMB.so 和 libcreatedata.so 放入 src/main/jniLibs/armeabi/folder

感谢任何人的帮助。

标记

4

0 回答 0