I'm tring to use Urban-airship cordova plugin (phonegap-ua-push) along with Facebook plugin (phonegap-facebook-plugin) but I facing this error:
Multiple dex files define Landroid/support/annotation/AnimRes
Which seems to be due to a conflic between the facebook android-support-v4 and phonegap-ua-push, as it compile with a different support-v4 version.
dependencies {
compile 'com.android.support:cardview-v7:22.2.0'
compile 'com.android.support:support-v4:22.2.0'
compile 'com.google.android.gms:play-services-location:7.5.0'
compile 'com.google.android.gms:play-services-gcm:7.5.0'
compile 'com.urbanairship.android:urbanairship-sdk:6.1.3'
}
I tried to update the phonegap-ua-push's dependencies, and exclude support-v4 that it rely on, hoping that it will be able to work with the Facebook one. Here is how I did that:
dependencies {
compile ('com.android.support:cardview-v7:22.2.0') {
exclude module: 'support-v4'
}
compile ('com.google.android.gms:play-services-location:7.5.0') {
exclude module: 'support-v4'
}
compile ('com.google.android.gms:play-services-gcm:7.5.0') {
exclude module: 'support-v4'
}
compile ('com.urbanairship.android:urbanairship-sdk:6.1.3') {
exclude module: 'support-v4'
}
}
But when the app receive a push notification, the app crash.. Here is the exception from logcat:
E/AndroidRuntime(24095): java.lang.NoSuchMethodError: No virtual method setColor(I)Landroid/support/v4/app/NotificationCompat$Builder; in class Landroid/support/v4/app/NotificationCompat$Builder; or its super classes (declaration of 'android.support.v4.app.NotificationCompat$Builder' appears in /data/app/com.****.****-1/base.apk)
Does someone have achieved to use both facebook and urbanairship plugins, and how ?
EDIT: As ralepinski said, I tried to remove the android-support-v4.jar from the platforms/android/FacebookLib/libs/ folder , and when I do I've got tones of the following error:
FacebookLib/src/com/facebook/AppEventsLogger.java:24: error: package android.support.v4.content does not exist import android.support.v4.content.LocalBroadcastManager; ...
I think it's tring to tell me that he can't find android-support-v4
Which doesnt make sense to me because the build.gradle of the FacebookLib as the following lines:
dependencies {
compile 'com.android.support:support-v4:[20,21)'
compile 'com.parse.bolts:bolts-android:1.1.2'
}
And so should be able to understand that android-support-v4 is needed. I probably miss-understand something here..
I tried as well to replace the android-support-v4 by the one used by phonegap-ua-push, android-support-v4-22.2.0, but it seems there is some missing symbol:
error: cannot find symbol FragmentManagerImpl mFragmentManager;
error: cannot find symbol FragmentManagerImpl mChildFragmentManager;
I finally solve my problem, by using this fork https://github.com/jeduan/cordova-plugin-facebook4 of the Facebook plugin, which use the last Facebook sdk.