简体   繁体   English

代号One Java扫描仪-移动应用生成错误

[英]Codename One Java Scanner - Mobile App Build Error

I am building a Codename One Mobile Java app that requires to scan bar codes. 我正在构建一个需要扫描条形码的Codename One Mobile Java应用程序。 I get build error on the build server. 我在构建服务器上收到构建错误。 It used to work but of late in the last month I can't build a scanner app. 它曾经可以工作,但是上个月末我无法构建扫描仪应用程序。 Has anyone encountered this challenge? 有人遇到过这个挑战吗? How can I resolve it? 我该如何解决? Below are the steps I took. 以下是我采取的步骤。 Thanks! 谢谢!

I created a sample cn1 hello world barebones app with the native theme. 我创建了一个带有原生主题的示例cn1 hello world准系统应用程序。

I imported these after adding the cn1-codescan and QRScanner libs using the Codename One Settings Wizard. 在使用“代号一个设置向导”添加cn1-codescan和QRScanner库之后,我导入了这些文件。 ext.codescan.CodeScanner and codename1.ext.codescan.ScanResult and littlemonkey.qrscanner.QRScanner ext.codescan.CodeScanner和codename1.ext.codescan.ScanResult和littlemonkey.qrscanner.QRScanner

I created button to scan a bar code. 我创建了按钮来扫描条形码。

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);
        }
    }
});

You need to remove the old cn1libs and install the latest version from the extension manager UI within Codename One Settings . 您需要在Codename One Settings的扩展管理器UI中删除旧的cn1libs并安装最新版本。

I suggest deleting the ios.* and android.* build hints too so refresh client libs will update them to the latest version. 我建议也删除ios.*android.*构建提示,因此刷新客户端库会将它们更新为最新版本。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM