首页 > 解决方案 > 尝试将 AndroidX 迁移到 Android AppCompat

问题描述

从 AndroidX 迁移到 Appcompat 时出现错误。这是日志构建:

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.1] AndroidManifest.xml:22:18-86 value=(androidx.core.app.CoreComponentFactory).
Suggestion: add 'tools:replace="android:appComponentFactory"' to <application> element at AndroidManifest.xml:18:5-138:19 to override.

标签: androidandroid-manifestandroidx

解决方案


因此,您想从 androidX 迁移回支持。如果是这种情况,请从 build.gradle 中删除以下库并添加旧的支持库。

androidx.core:core:1.0.1

并且还删除 gradle.properties 文件中的以下两个属性。

android.useAndroidX=true

android.enableJetifier=true

或者,如果您想迁移到 Androidx,则将这两个属性添加到 gradle.properties 文件中。

android.useAndroidX=true

android.enableJetifier=true

推荐阅读