2017-10-16 80 views
1

我進口的依賴越來越之後在圖書館的衝突:衝突庫導入播放服務後

compile 'com.google.android.gms:play-services:11.4.2' 

這是在這一行報告錯誤行:

compile 'com.android.support:appcompat-v7:26.1.0' 

這是的錯誤:

All com.android.support libraries must use the exact same version specification (mixing versions can lead to runtime crashes). 

Found version 26.1.0, 25.2.0 

如果我改線

compile 'com.android.support:appcompat-v7:26.1.0' 

到:

compile 'com.android.support:appcompat-v7:25.2.0' 

現在,我得到

This support library should not use a different version (25) than the compile SDK version (26). 

發生了什麼。這就像某種圓形的錯誤。

我該如何解決?

回答

0

其他地方(可能在依賴項中),您正在編譯版本爲25.2.0的Android支持庫的另一部分。如果你想使用編譯SDK版本26,那麼你需要將所有對com.android.support的引用更新到版本26.1.0。

0

由於錯誤說:

All com.android.support libraries must use the exact same version specification (mixing versions can lead to runtime crashes).

Found version 26.1.0, 25.2.0

這是因爲你有兩個支持庫是26.1.025.2.0。有一個或多個庫使用不同版本的支持庫。所以,你需要找到它並在依賴中使用排除。

./gradlew app:dependencies 

你發現它後,排除支持庫:您可以通過在Linux的shell在你的項目中執行以下命令看的依賴關係樹(如果你使用的是Windows使用gradlew.bat)發現他們從它:

compile(com.sample.library) { 
    exclude group: 'com.android.support' 

    // exclude the support library that is clashing. 
    exclude module: 'appcompat-v7' 
    exclude module: 'support-v4' 
} 

然後,你需要添加支持庫,以取代先前的依賴性排除版本:

compile 'com.android.support:appcompat-v7:26.1.0'