'Application not syncing when adding AdMob dependencies

Hello I am new to android and I am having an issue syncing my app when trying to add the dependencies for the the admob the following error appears:

''' In project 'app' a resolved Google Play services library dependency depends on another at an exact version (e.g. "[18.0. 2]", but isn't being resolved to that version. Behavior exhibited by the library will be unknown.

Dependency failing: com.google.android.gms:play-services-measurement-api:18.0.2 -> com.google.android.gms:play-services- measurement-sdk-api@[18.0.2], but play-services-measurement-sdk-api version was 18.0.3.

The following dependencies are project dependencies that are direct or have transitive dependencies that lead to the art ifact with the issue. -- Project 'app' depends onto com.google.firebase:firebase-bom@{strictly 26.8.0} -- Project 'app' depends onto com.google.android.gms:play-services-ads-lite@{strictly 20.6.0} -- Project 'app' depends onto com.google.android.gms:play-services-measurement-sdk-api@{strictly 18.0.3} -- Project 'app' depends onto com.google.firebase:[email protected] -- Project 'app' depends onto com.google.android.gms:play-services-measurement-api@{strictly 18.0.2} -- Project 'app' depends onto com.google.android.gms:play-services-ads@{strictly 20.6.0} -- Project 'app' depends onto com.google.android.gms:[email protected] -- Project 'app' depends onto com.google.firebase:firebase-analytics@{strictly 18.0.2} -- Project 'app' depends onto com.google.android.gms:[email protected]

For extended debugging info execute Gradle from the command line with ./gradlew --info :app:assembleDebug to see the dep endency paths to the artifact. This error message came from the google-services Gradle plugin, report issues at https:// github.com/google/play-services-plugins and disable by adding "googleServices { disableVersionCheck = true }" to your bu ild.gradle file. '''

the following is the build.gradle file :

plugins {
    id 'com.android.application'
    id 'com.google.gms.google-services'
}
apply plugin: 'kotlin-android'
apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'

android {
    compileSdkVersion 29
    buildToolsVersion "30.0.2"

    defaultConfig {
        applicationId "rubydev.learningforkids"
        minSdkVersion 21
        targetSdkVersion 29
        versionCode 1
        versionName "1.0"

        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
}

dependencies {

    implementation 'androidx.appcompat:appcompat:1.2.0'
    implementation 'com.google.android.material:material:1.2.1'
    implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
    implementation 'androidx.work:work-runtime:2.3.4'
    implementation 'androidx.legacy:legacy-support-v4:1.0.0'
    implementation 'androidx.recyclerview:recyclerview:1.1.0'
    implementation 'com.google.firebase:firebase-auth:20.0.3'
    implementation 'com.google.firebase:firebase-firestore:22.1.2'
    implementation 'com.google.firebase:firebase-storage:19.2.2'
    implementation 'androidx.lifecycle:lifecycle-livedata-ktx:2.2.0'
    implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.2.0'
    implementation 'androidx.navigation:navigation-fragment:2.3.3'
    implementation 'androidx.navigation:navigation-ui:2.3.3'
    implementation 'com.google.android.gms:play-services-ads-lite:20.6.0'
    testImplementation 'junit:junit:4.+'
    androidTestImplementation 'androidx.test.ext:junit:1.1.2'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
    implementation platform('com.google.firebase:firebase-bom:26.8.0')
    implementation 'com.google.firebase:firebase-analytics'

    implementation "androidx.core:core-ktx:1.6.0"

    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"

    implementation 'com.google.android.material:material:1.1.0-alpha10'

    implementation 'com.thebluealliance:spectrum:0.7.1'

    implementation 'com.squareup.picasso:picasso:2.71828'

    implementation 'com.tomer:fadingtextview:2.6'

    implementation 'pl.droidsonroids.gif:android-gif-drawable:1.2.19'

    implementation 'de.hdodenhof:circleimageview:3.0.0'

    implementation 'com.google.android.material:material:1.3.0-alpha03'

    implementation 'com.github.dhaval2404:imagepicker:2.1'

    implementation 'com.github.lzyzsd:circleprogress:1.2.1'

    implementation 'net.danlew:android.joda:2.10.9.1'

    implementation 'io.github.pilgr:paperdb:2.7.1'

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

    implementation 'com.google.android.ads.consent:consent-library:1.0.6'

    implementation 'com.firebaseui:firebase-ui-auth:4.2.0'

}
repositories {
    mavenCentral()
}


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source