0
dependencies {
    implementation "org.jetbrains.anko:anko-commons:$anko_version"

    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
    implementation 'com.android.support:appcompat-v7:27.1.1'
    implementation 'com.android.support.constraint:constraint-layout:1.1.3'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.2'
    androidTestImplementation 'com.android.support.test.espresso:espressocore:3.0.2'
}

These were my codes.


implementation 'com.google.android.gms:play-services-ads:17.1.1'

But when I add this AdMob code,

implementation 'com.android.support:appcompat-v7:27.1.1'

this code makes error:

All com.android.support libraries must use the exact same version specification (mixing versions can lead to runtime crashes). Found versions 27.1.1, 26.1.0. Examples include com.android.support:animated-vector-drawable:27.1.1 and com.android.support:customtabs:26.1.0 less... (Ctrl+F1) 
Inspection info:There are some combinations of libraries, or tools and libraries, that are incompatible, or can

What can I do?

capture image

Morteza Jalambadani
  • 2,190
  • 6
  • 21
  • 35
  • Possible duplicate of [Error: fix the version conflict (google-services plugin)](https://stackoverflow.com/questions/45500934/error-fix-the-version-conflict-google-services-plugin) – Zoe Mar 17 '19 at 11:41
  • Use `./gradlew app:dependencies`, then you can find two different versions. – galcyurio Mar 18 '19 at 03:59

1 Answers1

1

This is probably because implementation 'com.google.android.gms:play-services-ads:17.1.1' is implicitly using support libraries 26.1.0. You can override the libraries by adding the exact version of the conflicted libraries. Add something like this:

implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support:animated-vector-drawable:27.1.1'
implementation 'com.android.support:appcompat-v7:customtabs:27.1.1'
ישו אוהב אותך
  • 28,609
  • 11
  • 78
  • 96