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,它的工作原理非常完美,只需要刪除所有的排除和實現行,所以如果你還沒有使用它,也可以這樣做。 –