ionic capacitor qrscanner activity compat

I'm creating an ionic capacitor application. In my app I have to use QR Scanner so I used https://ionicframework.com/docs/native/qr-scanner plugin to integrate qr scanner. Then I do ionic capacitor copy android and ionic capacitor open android . Then in android studio when I try to build it throws

capacitor-cordova-android-plugins/src/main/java/com/bitpay/cordova/qrscanner/QRScanner.java -cannot find symbol class ActivityCompat -cannot find symbol variable ActivityCompat

Ionic version is 6.4.0 and android studio version is 3.6.2

Can some one help me to solve this.


Capacitor 2.0 uses Android X, that means all plugins have to use Android X too and that one is not updated.

As workarounds you can use Capacitor 1.5.2 or use jetifier to patch plugins to use Android X.

npm install jetifier
npx jetifier
npx cap sync android