com.google.firebase库:firebase-iid正在[[17.0.0,17.0.0]]的各个其他库请求,但已解析为16.2.0

Luc*_*irl 38 android google-play-services android-gradle-plugin react-native react-native-android

我今天开始收到此错误,昨天一切正常,gradle或firebase版本没有变化

com.google.firebase库:firebase-iid正在[[17.0.0,17.0.0]]的各个其他库请求,但解析为16.2.0.禁用插件并使用./gradlew:app:dependencies检查依赖关系树.

我看到昨天是谷歌服务插件的更新,可能是导致问题.

如何解决这个问题?

小智 33

我遇到过同样的问题.快速解决方法是禁用导致此问题的严格版本检查.加

com.google.gms.googleservices.GoogleServicesPlugin.config.disableVersionCheck = true
Run Code Online (Sandbox Code Playgroud)

在你的app build.gradle文件的最底部.

  • 我想这可能有一些不好的副作用? (21认同)
  • 不为我工作。我得到这个:“没有这样的属性:类的配置:com.google.gms.googleservices.GoogleServicesPlugin” (7认同)
  • 这个人应该尽快喝啤酒。对我来说很棒。 (2认同)

mas*_*mjm 18

我遇到过同样的问题。我通过将Firebase消息更新为最新版本(此时)解决了该问题。

implementation 'com.google.firebase:firebase-messaging:17.0.0'

implementation 'com.google.firebase:firebase-messaging:17.3.4'

并且解决了(没有副作用)


Ana*_*dze 11

对我来说,禁用版本检查并不能解决问题。我所做的是从firebase消息传递库中排除firebase-iid模块,并将其单独添加

implementation ("com.google.firebase:firebase-messaging:17.3.4"){
        exclude group: 'com.google.firebase', module: 'firebase-iid'
    }

implementation 'com.google.firebase:firebase-iid:17.0.3'
Run Code Online (Sandbox Code Playgroud)


sfr*_*ini 10

如果您遇到此问题,可能会看到很多帖子说您可以禁用此检查.我不喜欢这样做,因为它隐藏了问题.

过了一会儿,我终于明白了,有些图书馆正在要求我没有的版本.所以我在build/app/build.gradle中添加了它并构建了它

实施"com.google.firebase:firebase-iid:17.0.2"

只需使用它所解决的版本,在你的情况下为16.2.0.

  • 谢谢。这是我的情况的解决方案。已从“com.google.firebase:firebase-messaging:21.1.0”更新为“:22.0.0”。之前这个实现声明就足够了。但现在我必须添加“com.google.firebase:firebase-iid:21.1.0”。我不知道为什么,但是有了它,项目就再次构建而没有错误。不幸的是,错误消息“重复的类”非常令人困惑! (4认同)
  • 这样可以解决问题。 (2认同)

小智 5

我今天遇到了同样的错误。我正在使用react-native-firebasereact-native-push-notification。运行./gradlew :app:dependencies我看到react-native-push-notification需要最新版本的com.google.firebase:firebase-messaging,而后者又需要com.google.firebase:firebase-iid:[17.0.0],从而导致错误。

我手动指定的早期版本firebase-messagingreact-native-push-notification描述在这里。这为我解决了问题:

// in android/build.gradle

ext {
    firebaseVersion = '17.1.0' // add this line
    // ...
}
Run Code Online (Sandbox Code Playgroud)


Ari*_*tee 5

使用以下firebase依赖项时,'com.google.firebase:firebase-iid出现了类似的错误:

  1. 实施'com.google.firebase:firebase-core:16.0.7'
  2. 实施'com.google.firebase:firebase-messaging:17.3.4'
  3. 实施'com.google.firebase:firebase-database:16.0.6'
  4. 实现'com.crashlytics.sdk.android:crashlytics:2.9.6'
  5. 实施'com.google.firebase:firebase-functions:16.1.3'

添加后

  • 实施'com.google.firebase:firebase-analytics:16.3.0'

它消失了。