BarcodeScanner & Facebook4 Plugins Not Compatible?

Hey All. Im in Cordova hell. More than a week and Ive made literally no progress.

When using the BarcodeScanner ionic native plugin and Facebook4 plugins separately they work fine. However together they wont build for Android (they build fine for iOS however android throws error)

Error:Execution failed for task ‘:app:transformDexArchiveWithExternalLibsDexMergerForDebug’. Unable to merge dex).

Apparently the facebook plugin includes the facebook sdk which includes a library that is used by many other Android SDK’s. Issue about this on github; However ive tried everything off here.

Anyone have these two plugins working together?

If so could you post what versions your running aswell as your ionic info?

Thanks and much love to anyone who can help.


I am facing the same issue with those two plugins. Getting build error with latest cordova-plugin-facebook4 plugin.

I found a workaround – I have successfully build with cordova-plugin-facebook4@1.7.4

I’m struggling with the same issue.

I’ve tried all the fixes listed in all the StackOverflow threads about this and all the Github Issues threads also.

I’ve even tried iamdevsaikat’s fix but still I get errors.

Has anyone beaten this?


Ok I got this working… I used iamdevsaikat’s fix by using Facebook Native Plugin Version 1.74

I ran this:

ionic cordova rm android


ionic cordova plugin add cordova-plugin-facebook4@1.7.4 -save --variable APP_ID="MY_FB_APP_ID" --variable APP_NAME="MY_FB_APP_NAME"

Then I ran:

ionic cordova platform add android@7.1.0

NOTE: the build failed on Android version 7.0.0 (which my ionic was getting by default) but works well on 7.1.0

Root cause seems to come from barcode scanner plugin.

The error message is not exactly the same but cause yes.

Quick fix:

cordova platform remove android

add the following in /plugins/phonegap-plugin-barcodescanner/src/android/barcodescanner.gradle

configurations {
    compile.exclude group: ''

cordova platform add android