How to scan QR Code(not barcode) and Barcode with Ionic5 & Capacitor3?

I am using an app of ionic-5 and capacitor-3,
I can use bar code to scan now
These is the plugin what i use for bar code scan

@ionic-native/barcode-scanner
phonegap-plugin-barcodescanner

But using the above plugin I can’t achieve QR code scanning
I want to know if ionic-5 and capacitor-3 can do QR scanning

Which plugins should i use

You can use version 2 of this plugin

(version 3 is for Capacitor 4)

1 Like

Hi Ionic’s julio-ionic
I tried this plugin and it really works, but he has a conflict with the plugin I use now when I use it at the same time.


This is what I already have:

@ionic-native/barcode-scanner
phonegap-plugin-barcodescanner

This is what I’m going to add

@capacitor-community/barcode-scanner


When I built them, they seemed to produce the same jar file
How can i solve this problem?

Duplicate class com.google.zxing.BarcodeFormat found in modules core-3.3.0.jar (com.google.zxing:core:3.3.0) and jetified-barcodescanner-release-2.1.5-runtime.jar (:barcodescanner-release-2.1.5:)
Duplicate class com.google.zxing.Binarizer found in modules core-3.3.0.jar (com.google.zxing:core:3.3.0) and jetified-barcodescanner-release-2.1.5-runtime.jar (:barcodescanner-release-2.1.5:)
Duplicate class com.google.zxing.BinaryBitmap found in modules core-3.3.0.jar (com.google.zxing:core:3.3.0) and jetified-barcodescanner-release-2.1.5-runtime.jar (:barcodescanner-release-2.1.5:)
Duplicate class com.google.zxing.ChecksumException found in modules core-3.3.0.jar (com.google.zxing:core:3.3.0) and jetified-barcodescanner-release-2.1.5-runtime.jar (:barcodescanner-release-2.1.5:)
....  ......
Duplicate class com.google.zxing.qrcode.detector.FinderPatternFinder found in modules core-3.3.0.jar (com.google.zxing:core:3.3.0) and jetified-barcodescanner-release-2.1.5-runtime.jar (:barcodescanner-release-2.1.5:)
Duplicate class com.google.zxing.qrcode.detector.FinderPatternFinder$1 found in modules core-3.3.0.jar (com.google.zxing:core:3.3.0) and jetified-barcodescanner-release-2.1.5-runtime.jar (:barcodescanner-release-2.1.5:)
Duplicate class com.google.zxing.qrcode.detector.FinderPatternFinder$CenterComparator found in modules core-3.3.0.jar (com.google.zxing:core:3.3.0) and jetified-barcodescanner-release-2.1.5-runtime.jar (:barcodescanner-release-2.1.5:)
Duplicate class com.google.zxing.qrcode.detector.FinderPatternFinder$FurthestFromAverageComparator found in modules core-3.3.0.jar (com.google.zxing:core:3.3.0) and jetified-barcodescanner-release-2.1.5-runtime.jar (:barcodescanner-release-2.1.5:)
Duplicate class com.google.zxing.qrcode.detector.FinderPatternInfo found in modules core-3.3.0.jar (com.google.zxing:core:3.3.0) and jetified-barcodescanner-release-2.1.5-runtime.jar (:barcodescanner-release-2.1.5:)
Duplicate class com.google.zxing.qrcode.encoder.BlockPair found in modules core-3.3.0.jar (com.google.zxing:core:3.3.0) and jetified-barcodescanner-release-2.1.5-runtime.jar (:barcodescanner-release-2.1.5:)
Duplicate class com.google.zxing.qrcode.encoder.ByteMatrix found in modules core-3.3.0.jar (com.google.zxing:core:3.3.0) and jetified-barcodescanner-release-2.1.5-runtime.jar (:barcodescanner-release-2.1.5:)
Duplicate class com.google.zxing.qrcode.encoder.Encoder found in modules core-3.3.0.jar (com.google.zxing:core:3.3.0) and jetified-barcodescanner-release-2.1.5-runtime.jar (:barcodescanner-release-2.1.5:)
Duplicate class com.google.zxing.qrcode.encoder.Encoder$1 found in modules core-3.3.0.jar (com.google.zxing:core:3.3.0) and jetified-barcodescanner-release-2.1.5-runtime.jar (:barcodescanner-release-2.1.5:)
Duplicate class com.google.zxing.qrcode.encoder.MaskUtil found in modules core-3.3.0.jar (com.google.zxing:core:3.3.0) and jetified-barcodescanner-release-2.1.5-runtime.jar (:barcodescanner-release-2.1.5:)
Duplicate class com.google.zxing.qrcode.encoder.MatrixUtil found in modules core-3.3.0.jar (com.google.zxing:core:3.3.0) and jetified-barcodescanner-release-2.1.5-runtime.jar (:barcodescanner-release-2.1.5:)
Duplicate class com.google.zxing.qrcode.encoder.QRCode found in modules core-3.3.0.jar (com.google.zxing:core:3.3.0) and jetified-barcodescanner-release-2.1.5-runtime.jar (:barcodescanner-release-2.1.5:)

You’ll have to uninstall one of them.

Both of them support QR and barcode.