All gms/firebase libraries must use the exact same version specification

五迷三道 提交于 2019-12-13 23:14:59

问题


All gms/firebase libraries must use the exact same version specification (mixing versions can lead to runtime crashes). Found versions 15.0.0, 12.0.1. Examples include com.google.android.gms:play-services-ads:15.0.0 and com.google.android.gms:play-services:12.0.1

There are some combinations of libraries, or tools and libraries, that are incompatible, or can lead to bugs. One such incompatibility is compiling with a version of the Android support libraries that is not the latest version (or in particular, a version lower than your targetSdkVersion).

android studio is giving me this error. How to solve this error? Here is the image of showing error.


回答1:


You need to add a resolution strategy in your build.gradle file to tell which version of the library need to be used while building your application. The configuration might look something like this.

configurations.all {
    resolutionStrategy {
        force 'com.android.support:design:25.3.1'
        force 'com.android.support:support-v4:25.3.1'
        force 'com.android.support:appcompat-v7:25.3.1'
    }
}

Modify as per your requirement of the library version.




回答2:


As it says itself

Found versions 15.0.0, 12.0.1.

You should use same version for all google gms libraries.

Replace this line

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

with this

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



回答3:


First of all use the whole play service is just wrong unless you really need every single sub-package, but from your screenshot you are already using some sub-package. The use of the whole play service package could means you need multi dex support because you include a lot of not needed methods, Proguard is your friend in this case. So my response is: just remove that line.



来源:https://stackoverflow.com/questions/50100108/all-gms-firebase-libraries-must-use-the-exact-same-version-specification

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!