Facebook SDK dependency conflict

6.1k views Asked by At

I am having this error:

enter image description here

On getting dependency tree, I found that there is nothing wrong with animated vector drawables but facebook's latest sdk has previous version of support-v4 custom tab. I tried excluding with exclude group command but its not working. Here is my dependency tree:

 +--- com.facebook.android:facebook-android-sdk:4.26.0@aar
|    +--- com.android.support:support-v4:26.0.1@aar
|    |    +--- com.android.support:support-compat:26.0.1@aar
|    |    |    \--- com.android.support:support-annotations:26.0.1@jar
|    |    +--- com.android.support:support-media-compat:26.0.1@aar
|    |    |    +--- com.android.support:support-annotations:26.0.1@jar
|    |    |    \--- com.android.support:support-compat:26.0.1@aar
|    |    |         \--- com.android.support:support-annotations:26.0.1@jar
|    |    +--- com.android.support:support-core-utils:26.0.1@aar
|    |    |    +--- com.android.support:support-annotations:26.0.1@jar
|    |    |    \--- com.android.support:support-compat:26.0.1@aar
|    |    |         \--- com.android.support:support-annotations:26.0.1@jar
|    |    +--- com.android.support:support-core-ui:26.0.1@aar
|    |    |    +--- com.android.support:support-annotations:26.0.1@jar
|    |    |    \--- com.android.support:support-compat:26.0.1@aar
|    |    |         \--- com.android.support:support-annotations:26.0.1@jar
|    |    \--- com.android.support:support-fragment:26.0.1@aar
|    |         +--- com.android.support:support-compat:26.0.1@aar
|    |         |    \--- com.android.support:support-annotations:26.0.1@jar
|    |         +--- com.android.support:support-core-ui:26.0.1@aar
|    |         |    +--- com.android.support:support-annotations:26.0.1@jar
|    |         |    \--- com.android.support:support-compat:26.0.1@aar
|    |         |         \--- com.android.support:support-annotations:26.0.1@jar
|    |         \--- com.android.support:support-core-utils:26.0.1@aar
|    |              +--- com.android.support:support-annotations:26.0.1@jar
|    |              \--- com.android.support:support-compat:26.0.1@aar
|    |                   \--- com.android.support:support-annotations:26.0.1@jar
|    +--- com.android.support:appcompat-v7:26.0.1@aar
|    |    +--- com.android.support:support-annotations:26.0.1@jar
|    |    +--- com.android.support:support-v4:26.0.1@aar
|    |    |    +--- com.android.support:support-compat:26.0.1@aar
|    |    |    |    \--- com.android.support:support-annotations:26.0.1@jar
|    |    |    +--- com.android.support:support-media-compat:26.0.1@aar
|    |    |    |    +--- com.android.support:support-annotations:26.0.1@jar
|    |    |    |    \--- com.android.support:support-compat:26.0.1@aar
|    |    |    |         \--- com.android.support:support-annotations:26.0.1@jar
|    |    |    +--- com.android.support:support-core-utils:26.0.1@aar
|    |    |    |    +--- com.android.support:support-annotations:26.0.1@jar
|    |    |    |    \--- com.android.support:support-compat:26.0.1@aar
|    |    |    |         \--- com.android.support:support-annotations:26.0.1@jar
|    |    |    +--- com.android.support:support-core-ui:26.0.1@aar
|    |    |    |    +--- com.android.support:support-annotations:26.0.1@jar
|    |    |    |    \--- com.android.support:support-compat:26.0.1@aar
|    |    |    |         \--- com.android.support:support-annotations:26.0.1@jar
|    |    |    \--- com.android.support:support-fragment:26.0.1@aar
|    |    |         +--- com.android.support:support-compat:26.0.1@aar
|    |    |         |    \--- com.android.support:support-annotations:26.0.1@jar
|    |    |         +--- com.android.support:support-core-ui:26.0.1@aar
|    |    |         |    +--- com.android.support:support-annotations:26.0.1@jar
|    |    |         |    \--- com.android.support:support-compat:26.0.1@aar
|    |    |         |         \--- com.android.support:support-annotations:26.0.1@jar
|    |    |         \--- com.android.support:support-core-utils:26.0.1@aar
|    |    |              +--- com.android.support:support-annotations:26.0.1@jar
|    |    |              \--- com.android.support:support-compat:26.0.1@aar
|    |    |                   \--- com.android.support:support-annotations:26.0.1@jar
|    |    +--- com.android.support:support-vector-drawable:26.0.1@aar
|    |    |    +--- com.android.support:support-annotations:26.0.1@jar
|    |    |    \--- com.android.support:support-compat:26.0.1@aar
|    |    |         \--- com.android.support:support-annotations:26.0.1@jar
|    |    \--- com.android.support:animated-vector-drawable:26.0.1@aar
|    |         +--- com.android.support:support-vector-drawable:26.0.1@aar
|    |         |    +--- com.android.support:support-annotations:26.0.1@jar
|    |         |    \--- com.android.support:support-compat:26.0.1@aar
|    |         |         \--- com.android.support:support-annotations:26.0.1@jar
|    |         \--- com.android.support:support-core-ui:26.0.1@aar
|    |              +--- com.android.support:support-annotations:26.0.1@jar
|    |              \--- com.android.support:support-compat:26.0.1@aar
|    |                   \--- com.android.support:support-annotations:26.0.1@jar
|    +--- com.android.support:cardview-v7:26.0.1@aar
|    |    \--- com.android.support:support-annotations:26.0.1@jar
|    +--- com.android.support:customtabs:25.3.1@aar
|    |    +--- com.android.support:support-compat:26.0.1@aar
|    |    |    \--- com.android.support:support-annotations:26.0.1@jar
|    |    \--- com.android.support:support-annotations:26.0.1@jar
|    +--- com.parse.bolts:bolts-android:1.4.0@jar
|    |    +--- com.parse.bolts:bolts-tasks:1.4.0@jar
|    |    \--- com.parse.bolts:bolts-applinks:1.4.0@jar
|    |         \--- com.parse.bolts:bolts-tasks:1.4.0@jar
|    \--- com.google.zxing:core:3.3.0@jar

I want to use latest appcompat library as I want to support Oreo. Can someone guide me on this? Also, isn't this facebook's fault to use older dependency for custom tabs? Thank you very much for your time and assistance in this matter.

2

There are 2 answers

6
ישו אוהב אותך On BEST ANSWER

Facebook SDK for Android is using support library version 25.3.1, so you need to exclude it to use the most recent support library. You can try using the following:

// Facebook SDK Dependencies, need to be excluded.
// compile 'com.android.support:support-v4:25.3.1'
// compile 'com.android.support:appcompat-v7:25.3.1'
// compile 'com.android.support:cardview-v7:25.3.1'
// compile 'com.android.support:customtabs:25.3.1'

compile ('com.facebook.android:facebook-android-sdk:4.26.0') {
     exclude group: 'com.android.support', module: 'support-v4'
     exclude group: 'com.android.support', module: 'appcompat-v7'
     exclude group: 'com.android.support', module: 'cardview-v7'
     exclude group: 'com.android.support', module: 'customtabs'
}
2
Jordan Silva On

For facebook-android-sdk:4.28.0 the list is a bit longer ;)

implementation 'com.android.support:support-v4:26.1.0'
implementation 'com.android.support:cardview-v7:26.1.0'
implementation 'com.android.support:customtabs:26.1.0'
implementation 'com.android.support:support-annotations:26.1.0'
implementation 'com.android.support:support-core-utils:26.1.0'
implementation('com.facebook.android:facebook-android-sdk:4.28.0') {
    exclude group: 'com.android.support', module: 'support-v4'
    exclude group: 'com.android.support', module: 'appcompat-v7'
    exclude group: 'com.android.support', module: 'cardview-v7'
    exclude group: 'com.android.support', module: 'customtabs'
    exclude group: 'com.android.support', module: 'support-annotations'
    exclude group: 'com.android.support', module: 'support-core-utils'
}