PDF417 / pdf417-phonegap

PDF417 and QR code scanning plugins for PhoneGap/Cordova framework
47 stars 21 forks source link

Merge Dex issue when trying to run with cordova-plugin-camera #53

Closed stephangrobler closed 5 years ago

stephangrobler commented 5 years ago

I have an app that when trying to add cordova-plugin-camera, I get the following error:

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.FragmentTransitionCompat21$2

I have gone to the site stated, and it states I should remove the duplicate lib, but there are multiple ones listed. I am a bit apprehensive just to start removing items and then it breaks the implementation.

Any advice of where I need to look to try and get this resolved.

I created a test app with the instructions in the readme given and the result is the same as soon as I add the cordova-plugin-camera plugin and I try to build again. Also, this is only for the android build, have not tried it on the ios yet. this is on cordova-android@8.0.0

i1E commented 5 years ago

Hi @stephanfx,

which version of the Cordova CLI you are using? Try with upgrading to the latest version, you can run:

npm update -g cordova
stephangrobler commented 5 years ago

Thanks for the feedback, I checked and the version I have installed is

C:\Development>cordova -v 9.0.0 (cordova-lib@9.0.1)

i1E commented 5 years ago

Hi @stephanfx,

please try to set the appcompat version 24.1.1 in our plugin, modify this line.

Problem is in the combination of our plugin and cordova-plugin-camera because cordova-plugin-camera uses older version of the support library: com.android.support:support-v4:24.1.1.

This should help.

stephangrobler commented 5 years ago

Thanks! It builds successfully for android now!