【问题标题】:there is an error in google mobile ads sdk for flutter while compiling proectgoogle mobile ads sdk for flutter 编译项目时出现错误
【发布时间】:2021-11-14 23:46:14
【问题描述】:

我制作了一个应用程序,我想在我的项目中放置广告,所以我在我的 Flutter 项目中使用了 google mobile ads sdk。但是我在编译我的项目时使用 sdk 时遇到问题,它显示了一些关于 android 依赖项的错误。 ` 出了什么问题: 无法确定任务 ':app:compileDebugJavaWithJavac' 的依赖关系。

未能通知依赖解析侦听器。 在项目“应用程序”中,已解决的 Google Play 服务库依赖项依赖于另一个确切版本(例如“[17.5. 0]",但未解析为该版本。库表现出的行为将是未知的。

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

在项目“app”中,已解决的 Google Play 服务库依赖项依赖于另一个具有确切版本的依赖项(例如“[17.5. 0]",但未解析为该版本。库表现出的行为将是未知的。

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

`

【问题讨论】:

    标签: android flutter dart dependencies


    【解决方案1】:

    确保您已添加:

    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'
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2020-08-12
      • 1970-01-01
      • 1970-01-01
      • 2017-03-14
      • 1970-01-01
      • 1970-01-01
      • 2020-08-21
      • 2013-03-04
      相关资源
      最近更新 更多