-1

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.

enter image description here

Reaz Murshed
  • 23,691
  • 13
  • 78
  • 98

3 Answers3

0

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.

Reaz Murshed
  • 23,691
  • 13
  • 78
  • 98
0

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.

greywolf82
  • 21,813
  • 18
  • 54
  • 108
  • i removed that line now it if giving me 2 errors. first one is AAPT2 error: check logs for details and second one is invalid resource type 'attr' for parent of style – Android Guy Apr 30 '18 at 12:12
  • Do you really think we have the crystal ball here? Edit the question and add erros and exceptions you have – greywolf82 Apr 30 '18 at 12:13
0

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'
Khemraj Sharma
  • 57,232
  • 27
  • 203
  • 212