Software Archive
Read-only legacy content

cordova-barcode-scanner will not install during build

Tony_D_1
Beginner
852 Views

Can anyone advise what is causing the following error, when I try to do an android build with the imported cordova plugin cordova-barcode-scanner.  I am getting the following error when I try to build.

  • Error: Plugin "AscertScanner" failed to install.

There is no other information telling me why it has failed.  

0 Kudos
1 Solution
Jaap_v_
New Contributor I
852 Views

Hi Tony,

I'm also using the a barcode scanner on an Android device in cordova / XDK.

Why don't you use the intel.xdk.device.scanBarcode()

this works right out of the box, so you don't need 3rd party plugins.


best regards, Jaap (CoSo)

View solution in original post

0 Kudos
6 Replies
Swati_S_Intel1
Employee
852 Views

There is a build log link on the build page. Can you click on that and get the log and attach here? Also, send the screenshot of your error.

0 Kudos
Anusha_M_Intel1
Employee
852 Views

Hi Tony,

From your previous post I understand that your problem, more than using the plugin methods is the plugin failing to install in an Intel XDK build. Let me see how I can help you. I created a blank project with the barcode scanner plugin. My app built just fine with the plugin installing as it is supposed to. Please see the attached image to refer to the values I have entered when importing the plugin from the web. 

Make sure you are not doing any mistakes at this step. If you are not and your project is still failing, I think I can help you narrow down the problem faster if you can zip your projects contents and send it to me via PM (personal message). 

0 Kudos
Tony_D_1
Beginner
852 Views

Hi Anusha,

You solution above solved my problem with the build.  It now builds fine.  However, I am now back to my original problem of the plugin not working.

I have created a Javascript file which is linked in the normal way through the head section of my index.html.  This is the javascript I have tried.

function clickScan() {
     cordova.plugins.barcodeScanner.scan(
        function (result) {
            alert("We got a barcode\n" +
                  "Result: " + result.text + "\n" +
                  "Format: " + result.format + "\n" +
                  "Cancelled: " + result.cancelled);
        }, 

        function (error) {
            alert("Scanning failed: " + error);
        }
    );
}

As you can see I have wrapped the suggested code in my own function which is bound to the button that should call the method. It does not work.

What am I doing wrong here?  Any help or suggestions would be appreciated.

 

0 Kudos
Jaap_v_
New Contributor I
853 Views

Hi Tony,

I'm also using the a barcode scanner on an Android device in cordova / XDK.

Why don't you use the intel.xdk.device.scanBarcode()

this works right out of the box, so you don't need 3rd party plugins.


best regards, Jaap (CoSo)

0 Kudos
Anusha_M_Intel1
Employee
852 Views

Hi Tony,

Please check out this simple test app I have attached calling the scan method of the phonegap barcode plugin. I did an android build and tested it on a nexus 5 device and it works.

I have created a button called scan and it is bound to the 'scan' function in js/app.js. app.js is referenced in index.html. On the built app, when you click on scan, it opens up the camera ready to scan a barcode. 

0 Kudos
Tony_D_1
Beginner
852 Views

Thanks Anusha,

I got the barcode scanner working using the intel.xdk.devices.barcodescanner.    I did do a build with your suggested code and it looks great.  I appreciate all your help the the effort you put into building a barcode app for me to refer to.

 

Regards

Tony Davidson

0 Kudos
Reply