更新Firebase构建版本后无法运行应用

时间:2019-07-09 13:42:09

标签: android firebase firebase-cloud-messaging

将Firebase云消息传递Gradle文件版本从17.4.0更新到19.0.1失败,并发生Gradle构建问题

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

ERROR: Manifest merger failed : Attribute application@appComponentFactory value=(android.support.v4.app.CoreComponentFactory) from [com.android.support:support-compat:28.0.0] AndroidManifest.xml:22:18-91
    is also present at [androidx.core:core:1.0.0] AndroidManifest.xml:22:18-86 value=(androidx.core.app.CoreComponentFactory).
    Suggestion: add 'tools:replace="android:appComponentFactory"' to <application> element at AndroidManifest.xml:70:5-482:19 to override.```

3 个答案:

答案 0 :(得分:1)

您遇到了不依赖AndroidX的依赖关系问题。 有关迁移到AndroidX here的信息。

说明:您有一些依赖于android support的依赖项(旧的,已弃用),并且有些依赖项取决于AndroidX。因此,合并它们时存在冲突。 通过将以下内容添加到AndroidX文件中,强制依赖项使用gradle.properties

android.useAndroidX=true
android.enableJetifier=true

  

使用Android Studio 3.2及更高版本,您可以快速迁移   现有的项目以通过选择Refactor> Migrate to来使用AndroidX   菜单栏中的AndroidX。

现在,查看此: Firebase release notes and mention to AndroidX。声明您需要在这些版本中使用AndroidX的官方文档。

编辑,仅用于添加提醒:

每当更新依赖项时,特别是主要版本(版本代码中的第一个,最重要的数字)时,阅读发行说明。如果您正在使用已经发布的软件,则甚至更多。这样可以挽救一些生命。

答案 1 :(得分:0)

如果您在项目文件夹中选择清单文件,然后将底部选项卡更改为“合并清单”,则可以找到有关合并问题的详细错误日志。

也许可以帮助您了解更多信息。请参阅附件。

enter image description here

答案 2 :(得分:0)

您不能拥有支持库和androidx库。您必须转换为androidx或删除androidx库并使用常规库。

相关问题