user10974468
user10974468

Reputation: 11

there is an error in google mobile ads sdk for flutter while compiling proect

I made an app and I want to put ads in my project so, I used google mobile ads sdk for my flutter project. But I have a problem using sdk cause while compiling my project it shows some errors about android dependencies. ` What went wrong: Could not determine the dependencies of task ':app:compileDebugJavaWithJavac'.

Failed to notify dependency resolution listener. In project 'app' a resolved Google Play services library dependency depends on another at an exact version (e.g. "[17.5. 0]", 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:17.5.0 -> com.google.android.gms:play-services-
 measurement-sdk-api@[17.5.0], but play-services-measurement-sdk-api version was 18.0.0.

 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 on project 'google_mobile_ads' which depends onto com.google.android.gms:[email protected]
 .0
 -- Project 'app' depends onto com.google.android.gms:play-services-ads-lite@{strictly 20.1.0}
 -- Project 'app' depends onto com.google.firebase:[email protected]
 -- Project 'app' depends onto com.google.android.gms:[email protected]
 -- Project 'app' depends onto com.google.android.gms:[email protected]
 -- Project 'app' depends onto com.google.android.gms:[email protected]
 -- Project 'app' depends onto com.google.android.gms:play-services-ads@{strictly 20.1.0}
 -- Project 'app' depends onto com.google.android.gms:[email protected]
 -- Project 'app' depends onto com.google.android.gms:play-services-measurement-api@{strictly 17.5.0}
 -- Project 'app' depends onto com.google.firebase:firebase-analytics@{strictly 17.5.0}
 -- Project 'app' depends onto com.google.android.gms:play-services-measurement-sdk-api@{strictly 18.0.0}

 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 strict-version-matcher-plugin Gradle plugin, report issu
 es at https://github.com/google/play-services-plugins and disable by removing the reference to the plugin ("apply 'stric
 t-version-matcher-plugin'") from build.gradle.

In project 'app' a resolved Google Play services library dependency depends on another at an exact version (e.g. "[17.5. 0]", 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:17.5.0 -> com.google.android.gms:play-services-
 measurement-sdk-api@[17.5.0], but play-services-measurement-sdk-api version was 18.0.0.

 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 on project 'google_mobile_ads' which depends onto com.google.android.gms:[email protected]
 .0
 -- Project 'app' depends onto com.google.android.gms:play-services-ads-lite@{strictly 20.1.0}
 -- Project 'app' depends onto com.google.firebase:[email protected]
 -- Project 'app' depends onto com.google.android.gms:[email protected]
 -- Project 'app' depends onto com.google.android.gms:[email protected]
 -- Project 'app' depends onto com.google.android.gms:[email protected]
 -- Project 'app' depends onto com.google.android.gms:play-services-ads@{strictly 20.1.0}
 -- Project 'app' depends onto com.google.android.gms:[email protected]
 -- Project 'app' depends onto com.google.android.gms:play-services-measurement-api@{strictly 17.5.0}
 -- Project 'app' depends onto com.google.firebase:firebase-analytics@{strictly 17.5.0}
 -- Project 'app' depends onto com.google.android.gms:play-services-measurement-sdk-api@{strictly 18.0.0}

 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 = false }" to your b
 uild.gradle file.

`

Upvotes: 1

Views: 501

Answers (1)

Jitendra Mistry
Jitendra Mistry

Reputation: 407

Make sure you have added:

1.android/build.gradle:

dependencies {
    classpath 'com.android.tools.build:gradle:4.1.0'
    //this line
    classpath 'com.google.gms:google-services:4.2.0'
}

2.android/app/build.gradle:
    //this line
    apply plugin: 'com.google.gms.google-services'

Upvotes: 1

Related Questions