expo-camera not detecting Barcode or QR Code on Android

Please provide the following:

  1. SDK Version: 44.0.0
  2. Platforms(Android/iOS/web/all): Android

I’m using Expo-Camera to read barcodes and QR codes, everything works fine during development with the Expo Go app. but after building the app (APK) using eas build the camera shows but It won’t detect anything.

Here’s an example QR Code that I’m trying to scan: [4 KB file on MEGA](QR Code Examples)

Any help is appreciated.
Thanks.

Hi,
We have same approach, and it works on build apk:

import { Camera } from 'expo-camera';
import { BarCodeScanner } from 'expo-barcode-scanner';
...
<Camera
  barCodeScannerSettings={{
    barCodeTypes: [BarCodeScanner.Constants.BarCodeType.qr]
    }}
  onBarCodeScanned={barcodeScannedCallback}
>

and in app.json

"android": {
    "permissions": [
         "CAMERA"
    ]         
},

we also ask for permissions:

const requestPermissions = async (
    onError: (message: string, error: object) => void
) => {
    try {
        const { status } = await BarCodeScanner.requestPermissionsAsync();
        return status === 'granted';
    } catch (error) {
        onError('Failed to get permissions for bar code scanner', error);
        return false;
    }
};
2 Likes

Thanks,

It works now after setting the barCodeScannerSettings

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.