首页 文章

Codename One Java Scanner - 移动应用程序构建错误

提问于
浏览
2

我正在构建一个需要扫描条形码的Codename One Mobile Java应用程序 . 我在构建服务器上遇到构建错误 . 它曾经工作但是在上个月末我无法构建扫描仪应用程序 . 有人遇到过这个挑战吗?我该如何解决?以下是我采取的步骤 . 谢谢!

我创建了一个带有原生主题的示例cn1 hello world barebones应用程序 .

我使用Codename One Settings Wizard添加cn1-codescan和QRScanner库后导入了这些 . ext.codescan.CodeScanner和codename1.ext.codescan.ScanResult和littlemonkey.qrscanner.QRScanner

我创建了按钮来扫描条形码 .

Button btn_scanBarcode = new Button("Barcode");
btn_scanBarcode.addActionListener(new ActionListener() 
{
    @Override
    public void actionPerformed(ActionEvent evt) 
    {
        if (CodeScanner.getInstance() != null) 
        {
            QRScanner.scanBarCode(new ScanResult() 
            {
                public void scanCompleted(String contents, String formatName, byte[] rawBytes) 
                {
                    Dialog.show("Completed", contents, "OK", null);
                }

                public void scanCanceled() 
                {
                    Dialog.show("Cancelled", "Scan Cancelled", "OK", null);
                }

                public void scanError(int errorCode, String message) 
                {
                    Dialog.show("Error", message, "OK", null);
                }
            });
        } 
        else 
        {
            Dialog.show("Not Supported","Bar Code Scanning is not available on this device","OK",null);
        }
    }
});

1 回答

  • 0

    您需要删除旧的cn1libs并从 Codename One Settings 中的扩展管理器UI安装最新版本 .

    我建议删除 ios.*android.* 构建提示,以便刷新客户端库将它们更新到最新版本 .

相关问题