Error barcode scanning in ionic capacitor @capacitor-mlkit/barcode-scanning

Hi install @capacitor-mlkit/barcode-scanning and until yesterday it was working on my device Android. Today it stopped working but on other devices it works. Does anyone know what is going on or how I can fix this?

Versions
@capacitor-mlkit/barcode-scanning”: “^5.0.2”,
@capacitor/core”: “4.6.1”,
@capacitor/android”: “3.4.3”,
@capacitor/app”: “1.1.1”,

I’m surprised it was working as you have a mix of versions that are not compatible between them.

@capacitor-mlkit/barcode-scanning 5 should be used with Capacitor 5, but you are using @capacitor/core 4 and @capacitor/android 3.

You should update everything to version 5, including @capacitor/app.

1 Like

This problem was fixed today, see bug(barcode-scanning): `scan failed` on some Android devices · Issue #38 · capawesome-team/capacitor-mlkit · GitHub.

There are two new methods and a new listener:

/**
 * Check if the Google Barcode Scanner module is available.
 *
 * Only available on Android.
 *
 * @since 5.1.0
 */
isGoogleBarcodeScannerModuleAvailable(): Promise<IsGoogleBarcodeScannerModuleAvailableResult>;
/**
 * Install the Google Barcode Scanner module.
 * 
 * Attention: This only starts the installation.  The googleBarcodeScannerModuleInstallProgress event listener will notify you when the installation is complete.
 *
 * Only available on Android.
 *
 * @since 5.1.0
 */
installGoogleBarcodeScannerModule(): Promise<void>;
/**
 * Called when the Google Barcode Scanner module is installed.
 *
 * Available on Android.
 *
 * @since 5.1.0
 */
addListener(
  eventName: 'googleBarcodeScannerModuleInstallProgress',
  listenerFunc: (
    event: GoogleBarcodeScannerModuleInstallProgressEvent,
  ) => void,
): Promise<PluginListenerHandle> & PluginListenerHandle;

With those you can check if the Google Barcode Scanner module is available and install it if necessary.

Install failed without any message, just state 5, it is possible to install previously

@JLoveI Please take a look at this comment.