2017-08-15 28 views
0

我试图使用一些库,但我得到以下错误。是否有可能重写库的依赖关系

All com.google.android.gms libraries must use the exact same version specification (mixing versions can lead to runtime crashes). Found versions 8.4.0, 10.2.1. Examples include com.google.android.gms:play-services:8.4.0 and com.google.android.gms:play-services-auth:10.2.1 less... (Ctrl+F1) 

我觉得像这样的东西应该可以工作,但我仍然会得到同样的错误。

compile'com.example.x:library:2.0.0', { 
    exclude group: 'com.android.support', module: 'support-compat' 
} 

是否有可能使外部库使用我的应用程序的依赖项,或者是否有解决方案?

谢谢。

+0

你能在这里发表您所有的依赖库? – Raja

回答

0

运行Gradle依赖关系报告查看完整的依赖关系树。

运行:

./gradlew -q dependencies <module-name>:dependencies --configuration compile 

例子:

./gradlew -q dependencies app:dependencies --configuration compile 
0

当你不得不使用多个com.google.android.gms库应该是相同的版本号。

现在

one is : 8.4.0 
another one is : 10.2.1 

您在使用必须改变,以相同的版本一样

com.google.android.gms:play-services:8.4.0 
com.google.android.gms:play-services-auth:8.4.0 

com.google.android.gms:play-services:10.2.1 
com.google.android.gms:play-services-auth:10.2.1 

注: 一旦你在COM来使用。 google.android.gms:play-services然后不需要使用特定的api(com.g oogle.android.gms:播放服务验证)。 因为com.google.android.gms:发挥服务是包含所有依赖

希望这将帮助你...