bitpay / cordova-plugin-qrscanner

A fast, energy efficient, highly-configurable QR code scanner for Cordova apps and the browser.
MIT License
573 stars 777 forks source link

Conflict with cordova-plugin-fcm-with-dependecy-updated #315

Open ircmgr opened 4 years ago

ircmgr commented 4 years ago

what can possible conflict between these two ?

Reproduce : create a project and add both cordova-plugin-fcm-with-dependecy-updated and cordova-plugin-qrscanner

execute cordova run and it will fail with :

`

D8: Program type already present: android.support.v4.os.ResultReceiver

FAILURE: Build failed with an exception.

BUILD FAILED in 8s

`

if you now change what you import first or re install the android platform (8.1.0) it fails with `D8: Program type already present: android.support.v4.app.INotificationSideChannel$Stub

FAILURE: Build failed with an exception.

Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.`

santisanudo13 commented 4 years ago

Hi,

I got exactly de same problem. Any updates?

ircmgr commented 4 years ago

i just used https://github.com/phonegap/phonegap-plugin-barcodescanner and fixed my issues. this project looks like deprecated/ unmaintained

jringbox commented 4 years ago

Any updates on this? I have this exact problem with cordova-plugin-fcm-with-dependecy-updated and cordova-plugin-firebase-messaging. I'm surprised this hasn't been fixed yet.

jringbox commented 4 years ago

Well that was a bust. I couldn't use phonegap-plugin-barcodescanner. That one has the same problem with building. I'm stuck.

vprabusiva commented 3 years ago

Hi, I am also facing same issue. Any one having solution??

PeterHdd commented 3 years ago

Niether qrscanner nor barcodescanner is working with fcm. The problem is that fcm is using the androidx package while both of those packages are still using the com.android.support (old support libraries).

To solve it do the following, open the gradle.properties file and add:

android.useAndroidX=true
android.enableJetifier=true

Then sync the project, its better if you do this on android studio and not vscode. Then open the QRScanner.java file and remove the import android.support.v4.app.ActivityCompat and instead add import androidx.core.app.ActivityCompat;. Also in IonicWebViewEngine.java file replace import android.support.annotation.RequiresApi; with import androidx.annotation.RequiresApi; and you will get build successful.

The above was done using cordova-andorid:8.0.0. In cordova-android:9.0.0 I think ionic migrated to androidx, so all you have to do is change gradle.properties and change in QrScanner.java.

You can check the mapping of the old support libraries with androidx here:

https://developer.android.com/jetpack/androidx/migrate/class-mappings