Bar Code Scanner Build error with android 11

Hi Team,
I used to use below plugin for bar code scanning purposes but seems like it is no longer supported in Andriod 11.

other settings as below

I have tried mutiple other barcode scanner but no luck. Can you please advise the barcode scanner plugin which is working with volt builder build.


use this plugin


We keep a list of the replaced plugins (that we know about) here.

Hi Zongororo/Team,

I am using this plugin phonegap-plugin-barcodescanner-android12 and Getting error.
Cordova is not defined.

My code as below

function getQrCode() {
    try {
        alert("in qr code");
        function (result) {
            //alert("We got a barcode\n" +
            //    "Result: " + result.text + "\n" +
            //    "Format: " + result.format + "\n" +
            //    "Cancelled: " + result.cancelled);
            hitSaveButtonBrixReading = 0;
        function (error) {
            alert("Scanning failed: " + error);
    catch (err) {
            showError("Failed while reading the QR code " + err);

Hit the first alert box then straight goes into the catch block.
Cordova is not defined.


Tip : If you’re pasting code, html or config files, surround the code with triple back ticks (```), before the first line and after the last one. It will be formatted properly. (We fixed it for you this time)

Are you running this on your device after making a new apk?

Yep I am running on my tablet device after creating a new apk but still no luck.

Is your main code module named index.html? That’s the module which defines cordova. If you have named your main module something else, that won’t happen.

Yep, m using index.html file. you can refer to my zip folder which i have uploaded just in case.
Still stuck with this issue. :frowning:

You have an index.html file, but it looks like your main page is actually main.html.

Can you get rid of the index.html that you have and rename main.html to index.html?

Otherwise, you could try adding this line to your section of your html:

<script src="cordova.js"></script>

Adding this line fixed my problem as I can see the camera to scan the barcode. thanks a ton.