2017-10-16 74 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'