BlinkID / blinkid-cordova

ID scanning for cross-platform apps built with Cordova and Phonegap.
48 stars 34 forks source link

Conflict with cordova-plugin-camera on Android #124

Closed AlibekJ closed 4 years ago

AlibekJ commented 4 years ago

Failing to build:

Problem

  • 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$1 Learn how to resolve the issue at https://developer.android.com/studio/build/dependencies#duplicate_classes.34 actionable tasks: 9 executed, 25 up-to-date

Environment

ubuntu 20.04, fresh plain vanilla cordova (Cordova CLI) : 9.0.0 (cordova-lib@9.0.1) cordova Platforms : android 8.1.0

Plugins: "blinkid-cordova": "^5.4.0", "cordova-android": "^8.1.0", "cordova-plugin-camera": "^4.1.0"

How to reproduce

cordova create test com.sample.app test
cordova plugin add blinkid-cordova
cordova plugin add cordova-plugin-camera
cordova platform add android
cordova prepare
cordova build android
i1E commented 4 years ago

Hi @AlibekJ,

we have migrated our SDK to AndroidX dependencies, from version 5.0. Old support libraries are deprecated in 2018 when Google decided to do all new library development in the AndroidX library.

This error happens because cordova-plugin-camera uses deprecated com.android.support:support-v4:27.+. They should update the dependency.

Also there is Android Jettifier tool for transforming dependencies to AndroidX, you can enable it in the project's gradle.properties file by adding this flags (https://developer.android.com/jetpack/androidx/migrate):

android.useAndroidX=true
android.enableJetifier=true

but cordova-plugin-camera should update dependency to at least com.android.support:support-v4:28.0.0 for this to work.