Search code examples
androidcordovajasminebarcode-scanner

Phonegap Barcode Scanner failed Jasmine error


I wrote an app using PhoneGap build. It's a barcode scanner. After I create the project and add the barcode plugin ( from the root directory.. cordova plugin add com.phonegap.plugins.barcodescanner)

scan : function() {
console.log('scanning');
var scanner = cordova.require("com.phonegap.plugins.barcodescanner.barcodescanner");
//var scanner = cordova.require("cordova/plugin/BarcodeScanner");

    scanner.scan(function(result) { ..... }  

After I build the app with PhoneGap Build and tested on my smartphone I got this error: enter image description here

What can I do to solve this error? I think I added the barcode plugin!?

How my index.html file looks like

<script type="text/javascript" src="js/jquery-2.1.0.min.js"></script>
<script type="text/javascript" src="js/jquery.mobile-1.4.2.js"></script>
<script type="text/javascript" src="cordova.js"></script>
<script type="text/javascript" src="barcodescanner.js"></script>
<script type="text/javascript" src="js/index.js"></script>

Solution

  • Okay guys. I'm done with this error. I installed the my project the android platform (cordova platform add android) than installed the barcodescanner plugin with plugman. And the error ins gone. :))