Cordova build failed - google analytics and facebook plugin conflicts

408 Views Asked by At

Im working on cordova application.

After installing
cordova-plugin-google-analytics (https://github.com/danwilson/google-analytics-plugin)
my build starts to fail with error code

Multiple dex files define Landroid/support/annotation/AnimRes

After spending few hours on resolving and googling i'm quite sure it's related to conflict with
phonegap-facebook-plugin (https://github.com/Wizcorp/phonegap-facebook-plugin/)
because phonegap-facebook-plugin uses android-support-v4 jar

One of solution was to remove android-support-v4, but this doesn't work for me (how it could if facebook just needs this jar..)

Another soluction was to create build-extras.gradle file with some content (can't remember) - also failed

Some of solutions was related to Android Studio stuff, i don't use Android Studio, i cannot use it. i'm buildind from command line.

Does anyone know another solution which i can try?

Thanks in advance

1

There are 1 best solutions below

0
On

I was having this exact issue and attempted all the same solutions. Eventually I found this forked version of the cordova FB plugin from Jeduan Cornejo - https://github.com/jeduan/cordova-plugin-facebook4 - which has worked so far with a relatively seamless transition. I have not done full regression testing, but have verified both these initials calls work:

window.analytics.startTrackerWithId('UA-xxx');

and

facebookConnectPlugin.logic(perms, function(resp){...});

If you do run into compilation problems after replacing the plugin, consider cordova platform rm android and then cordova platform add android