6

我有此错误:的Facebook SDK依赖冲突

enter image description here

在越来越依赖关系树,我发现有什么不对的动画矢量绘图资源,但Facebook的最新SDK提供了支持-V4定制的先前版本标签。我尝试排除排除组命令,但它不工作。这里是我的依赖关系树:

+--- com.facebook.android:facebook-android-sdk:[email protected] 
| +--- com.android.support:support-v4:[email protected] 
| | +--- com.android.support:support-compat:[email protected] 
| | | \--- com.android.support:support-annotations:[email protected] 
| | +--- com.android.support:support-media-compat:[email protected] 
| | | +--- com.android.support:support-annotations:[email protected] 
| | | \--- com.android.support:support-compat:[email protected] 
| | |   \--- com.android.support:support-annotations:[email protected] 
| | +--- com.android.support:support-core-utils:[email protected] 
| | | +--- com.android.support:support-annotations:[email protected] 
| | | \--- com.android.support:support-compat:[email protected] 
| | |   \--- com.android.support:support-annotations:[email protected] 
| | +--- com.android.support:support-core-ui:[email protected] 
| | | +--- com.android.support:support-annotations:[email protected] 
| | | \--- com.android.support:support-compat:[email protected] 
| | |   \--- com.android.support:support-annotations:[email protected] 
| | \--- com.android.support:support-fragment:[email protected] 
| |   +--- com.android.support:support-compat:[email protected] 
| |   | \--- com.android.support:support-annotations:[email protected] 
| |   +--- com.android.support:support-core-ui:[email protected] 
| |   | +--- com.android.support:support-annotations:[email protected] 
| |   | \--- com.android.support:support-compat:[email protected] 
| |   |   \--- com.android.support:support-annotations:[email protected] 
| |   \--- com.android.support:support-core-utils:[email protected] 
| |    +--- com.android.support:support-annotations:[email protected] 
| |    \--- com.android.support:support-compat:[email protected] 
| |     \--- com.android.support:support-annotations:[email protected] 
| +--- com.android.support:appcompat-v7:[email protected] 
| | +--- com.android.support:support-annotations:[email protected] 
| | +--- com.android.support:support-v4:[email protected] 
| | | +--- com.android.support:support-compat:[email protected] 
| | | | \--- com.android.support:support-annotations:[email protected] 
| | | +--- com.android.support:support-media-compat:[email protected] 
| | | | +--- com.android.support:support-annotations:[email protected] 
| | | | \--- com.android.support:support-compat:[email protected] 
| | | |   \--- com.android.support:support-annotations:[email protected] 
| | | +--- com.android.support:support-core-utils:[email protected] 
| | | | +--- com.android.support:support-annotations:[email protected] 
| | | | \--- com.android.support:support-compat:[email protected] 
| | | |   \--- com.android.support:support-annotations:[email protected] 
| | | +--- com.android.support:support-core-ui:[email protected] 
| | | | +--- com.android.support:support-annotations:[email protected] 
| | | | \--- com.android.support:support-compat:[email protected] 
| | | |   \--- com.android.support:support-annotations:[email protected] 
| | | \--- com.android.support:support-fragment:[email protected] 
| | |   +--- com.android.support:support-compat:[email protected] 
| | |   | \--- com.android.support:support-annotations:[email protected] 
| | |   +--- com.android.support:support-core-ui:[email protected] 
| | |   | +--- com.android.support:support-annotations:[email protected] 
| | |   | \--- com.android.support:support-compat:[email protected] 
| | |   |   \--- com.android.support:support-annotations:[email protected] 
| | |   \--- com.android.support:support-core-utils:[email protected] 
| | |    +--- com.android.support:support-annotations:[email protected] 
| | |    \--- com.android.support:support-compat:[email protected] 
| | |     \--- com.android.support:support-annotations:[email protected] 
| | +--- com.android.support:support-vector-drawable:[email protected] 
| | | +--- com.android.support:support-annotations:[email protected] 
| | | \--- com.android.support:support-compat:[email protected] 
| | |   \--- com.android.support:support-annotations:[email protected] 
| | \--- com.android.support:animated-vector-drawable:[email protected] 
| |   +--- com.android.support:support-vector-drawable:[email protected] 
| |   | +--- com.android.support:support-annotations:[email protected] 
| |   | \--- com.android.support:support-compat:[email protected] 
| |   |   \--- com.android.support:support-annotations:[email protected] 
| |   \--- com.android.support:support-core-ui:[email protected] 
| |    +--- com.android.support:support-annotations:[email protected] 
| |    \--- com.android.support:support-compat:[email protected] 
| |     \--- com.android.support:support-annotations:[email protected] 
| +--- com.android.support:cardview-v7:[email protected] 
| | \--- com.android.support:support-annotations:[email protected] 
| +--- com.android.support:customtabs:[email protected] 
| | +--- com.android.support:support-compat:[email protected] 
| | | \--- com.android.support:support-annotations:[email protected] 
| | \--- com.android.support:support-annotations:[email protected] 
| +--- com.parse.bolts:bolts-android:[email protected] 
| | +--- com.parse.bolts:bolts-tasks:[email protected] 
| | \--- com.parse.bolts:bolts-applinks:[email protected] 
| |   \--- com.parse.bolts:bolts-tasks:[email protected] 
| \--- com.google.zxing:core:[email protected] 

我想使用最新的程序兼容性库,我想支持奥利奥。有人可以指导我吗?另外,这不是Facebook的错误使用旧的依赖关系的自定义选项卡?非常感谢您在这个问题上的时间和协助。

回答

14

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

非常感谢!有效。但依赖关系树显示只有customtabs是25.3.1。此外,为什么Facebook会睡觉?任何想法? –

+0

imho,上面的代码只是一个简单的方法来确保冲突的支持库不包括在Facebook的SDK版本4.26.0。您可以尝试仅排除customtabs。对不起,我真的不明白'为什么Facebook会睡觉?'你能详细说明吗? –

+0

我试过customtabs它没有工作。关于脸书睡觉,只是一个笑话。我的意思是为什么他们没有升级它们的sdk中的依赖关系。 –

10

对于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' 
} 
+0

任何解决方案4.29.0?它来自27.0.1,但最后的支持是27.0.2,所以如果我排除com.android.support从Facebook sdk像4.28.0它会返回一些combile错误:( - > ... /。gradle/caches/transforms -1/files-1.1/facebook-common-4.29.0.aar/be3a9d27cd44a8128aadc980156f8f12/res/layout/com_facebook_device_auth_dialog_fragment.xml。我尝试从gadle中删除缓存,但没有帮助 – Pelanes

+0

我刚刚使用fb sdk升级到4.30.0支持库27.0.2,它的工作原理非常完美,只需要删除所有的排除和实现行,所以如果你还没有使用它,也可以这样做。 –