Facebook SDK 依赖冲突

Facebook SDK dependency conflict

我有这个错误:

在获取依赖树时,我发现动画矢量可绘制对象没有任何问题,但facebook 最新的sdk 具有旧版本的support-v4 自定义选项卡。我尝试使用 exclude group 命令进行排除,但它不起作用。这是我的依赖关系树:

 +--- 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

我想使用最新的 appcompat 库,因为我想支持 Oreo。有人可以指导我吗?另外,这不是 facebook 对自定义选项卡使用旧依赖项的错吗?非常感谢您在这件事上的时间和帮助。

Facebook SDK for Android 正在使用支持库版本 25.3.1,因此您需要将其排除以使用最新的支持库。您可以尝试使用以下方法:

// 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'
}

对于 facebook-android-sdk:4.28.0 列表有点长 ;)

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'
}