cordova-plugin-qrscanner icon indicating copy to clipboard operation
cordova-plugin-qrscanner copied to clipboard

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

Open ircmgr opened this issue 4 years ago • 6 comments

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.

  • What went wrong: Execution failed for task ':app:transformDexArchiveWithExternalLibsDexMergerForDebug'.

com.android.builder.dexing.DexArchiveMergerException: Error while merging dex archives: Program type already present: android.support.v4.os.ResultReceiver Learn how to resolve the issue at https://developer.android.com/studio/build/dependencies#duplicate_classes.

  • Try: 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.

  • Get more help at https://help.gradle.org

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.

  • What went wrong: Execution failed for task ':app:transformDexArchiveWithExternalLibsDexMergerForDebug'.

com.android.builder.dexing.DexArchiveMergerException: Error while merging dex archives: Learn how to resolve the issue at https://developer.android.com/studio/build/dependencies#duplicate_classes.
Program type already present: android.support.v4.app.INotificationSideChannel$Stub

  • Try:> Task :app:transformDexArchiveWithExternalLibsDexMergerForDebug FAILED 35 actionable tasks: 35 executed

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.`

ircmgr avatar Apr 23 '20 19:04 ircmgr

Hi,

I got exactly de same problem. Any updates?

santisanudo13 avatar May 14 '20 09:05 santisanudo13

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

ircmgr avatar May 17 '20 13:05 ircmgr

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 avatar Jul 14 '20 19:07 jringbox

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

jringbox avatar Jul 14 '20 19:07 jringbox

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

vprabusiva avatar Dec 31 '20 04:12 vprabusiva

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

PeterHdd avatar Jan 10 '21 09:01 PeterHdd