【问题标题】:Compilation error when adding dependency: com.google.firebase:firebase-core添加依赖项时出现编译错误:com.google.firebase:firebase-core
【发布时间】:2019-08-23 16:33:33
【问题描述】:

我正在尝试修改 Cordova 插件 Phonegap Plugin Push plugin 以包含 FirebaseAnalytics。为此,我在 plugin.xml 中添加了 firebase-core 作为依赖项:

<framework src="com.google.firebase:firebase-core:16.0.8"/>

如果我将此插件添加到新项目(未安装其他插件)并尝试编译,我会收到错误:

Failed to notify dependency resolution listener.
> The library com.google.android.gms:play-services-basement is being requested by various other libraries at [[15.0.1,15.0.1]], but resolves to 16.2.0. Disable the plugin and check your dependencies tree using ./gradlew :app:dependencies.
> The library com.google.firebase:firebase-iid is being requested by various other libraries at [[16.0.0,16.0.0]], but resolves to 17.0.3. Disable the plugin and check your dependencies tree using ./gradlew :app:dependencies.

我不知道这种冲突从何而来。我尝试在项目中搜索play-services-basementfirebase-iid,但没有匹配项。我也没有在 gradle 依赖列表中看到它们。

我该如何解决这个问题?找出这种冲突来自何处的最佳方法是什么?

【问题讨论】:

    标签: android firebase cordova gradle push-notification


    【解决方案1】:

    转到platform/android/project.properties,然后指定您要使用的版本。 而不是使用“+” com.google.firebase:firebase-messaging:17.3.+ 使用指定版本 com.google.firebase:firebase-messaging:17.6.0

    【讨论】:

      【解决方案2】:

      我可以通过将“com.google.firebase:firebase-messaging:”的版本更新到 17.5.0 来解决这个问题,我使用的是 17.0.0

      【讨论】:

        最近更新 更多