Android: Uncaught module cordova/plugin/BarcodeScanner not found

  • 1
  • Problem
  • Updated 7 years ago
No matter what I do, I get
D/CordovaLog(19230): Uncaught module cordova/plugin/BarcodeScanner not found

E/Web Console(19230): Uncaught module cordova/plugin/BarcodeScanner not found at file:///android_asset/www/phonegap.js:50

I have this in config.xml:
<gap:plugin name="BarcodeScanner"/>

I get the error message when I do this:
scanner = cordova.require("cordova/plugin/BarcodeScanner");

The BuildID is 448515.

Unzipping the .apk, I do not see barcodescanner.js.
Photo of gh

gh

  • 34 Posts
  • 0 Reply Likes

Posted 7 years ago

  • 1
Photo of ryan

ryan, Developer

  • 1538 Posts
  • 132 Reply Likes
You need to include
<script src="barcodescanner.js"></script>
In your index.html, right after phonegap.js.

I checked your apk and the BarcodeSanner plugin was successfully installed, including barcodescanner.js.
Photo of gh

gh

  • 34 Posts
  • 0 Reply Likes
Yup, that was it. I was sure that line was in there, but it must have disappeared as I was trying everything else.

Thanks!
Photo of Alex Pashley

Alex Pashley

  • 94 Posts
  • 1 Reply Like
ryan, where in the documentation does it say to include barcodescanner.js?

This had me stumped for quite a while :(