Barcode Scanner working in dev, not built apps
See original GitHub issueWhile developing (serving locally and viewing on the Tabris developer app) my app’s barcode scanner works fine. For both iOS and Android.
However, when I build and deploy (with or without debug mode enabled) to my devices, the barcode scanner does not work.
This is the error message in the debug console:
undefined is not an object (evaluating 'cordova.plugins.barcodeScanner')
I have 2 cordova plugins registered in cordova/config.xml
like so:
<plugin name="cordova-plugin-barcodescanner" spec="6.0.5" />
<plugin name="cordova-plugin-x-toast" spec="2.5.2" />
See also #1088 for how I determined version/spec
The toast plugin is working fine. The code to trigger to barcode scanner is based on the Tabris examples, here is my implementation:
var ScanProductPage = function () {
this.page = new tabris.Page({
id: 'scanProductPage',
title: "Scan Product",
image: './assets/icons/barcode.png',
topLevel: true
});
new tabris.Button({
layoutData: {left: 10, top: 10, right: 10},
text: "Scan Barcode"
}).on("select", scanBarcode).appendTo(this.page);
var resultView = new tabris.TextView({
layoutData: {top: "prev() 20", left: 20, right: 20},
markupEnabled: true
}).appendTo(this.page);
function scanBarcode() {
cordova.plugins.barcodeScanner.scan(function (result) {
resultView.set("text", result.cancelled ?
"<b>Scan cancelled</b>" :
"<b>Scan result:</b> " + result.text + " (" + result.format + ")");
}, function (error) {
resultView.set("text", "<b>Error:</b> " + error);
},
{
preferFrontCamera : false,
showFlipCameraButton : true,
showTorchButton : true,
prompt : "Place a barcode inside the scan area"
});
}
};
module.exports = ScanProductPage;
I tried rolling back to an earlier version of the barcodescanner plugin (6.0.3) to no avail.
Issue Analytics
- State:
- Created 7 years ago
- Comments:8 (8 by maintainers)
Top Results From Across the Web
Scanner not working in app release / build · Issue #91 - GitHub
The barcode scanner is working fine in dev/debug mode but not in release. package version react-native 0.68.3 react-native-reanimated 2.4.1 ...
Read more >How to Develop a Barcode Scanning App? - Matellio Inc
Here's the complete process for barcode scanning app development! ... To know the working of barcode scanner apps, let us first discuss its ......
Read more >Configure a barcode scanner to support specific applications
Tutorial - Learn how to configure a barcode scanner to support specific applications.
Read more >iOS 16 - Scanning barcode | Apple Developer Forums
Hi all,. I have an issue with barcode scanning on iOS 16 (and only on iOS 16). Our app doesn't scan barcode correctly,...
Read more >Creating a No-code Barcode Scanner App - YouTube
Now it's time to put what we've learned to use by creating an application. The application we're going to create is going to...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I agree-my vote would be to fail the build if a plugin can’t be downloaded.
According to the Cordova spec the
spec
attribute is required but will defer to “the latest plugin version published to npm” if it can’t figure out the version based on other criteria. I just learned it’ll also take semver strings, so that’s pretty cool.@camstuart @cookieguru Thanks for the input! I’ve opened #1148 and am closing this issue.