大四寒假日期汇报3.4

Android Studio Gradle添加新依赖产生错误:

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

猜测原因: app.compat包与Androix包的冲突问题,因为引入的新依赖需要Androix。

解决办法:Suggestion: add 'tools:replace="android:appComponentFactory"' to <application> element at AndroidManifest.xml:8:5-35:19 to override.

在AndroidManifest.xml文件中添加:

        android:appComponentFactory=""
        tools:replace="android:appComponentFactory"

 有的特殊情况,即使添加了也没有通过的,可以参考文章:https://www.jianshu.com/p/f7a7a8765294?tdsourcetag=s_pctim_aiomsg

原文地址:https://www.cnblogs.com/heiyang/p/14478216.html