Android AndroidManifest.xml 覆盖问题Manifest merger failed
项目引用第三方库或者本地库的时候经常遇到AndroidManifest.xml 覆盖合并等冲突问题:
add 'tools:replace=“android:icon” 、add 'tools:replace=“android:appComponentFactory”
比如1:
Manifest merger failed : Attribute application@icon value=(@drawable/ic_launcher) from AndroidManifest.xml:22:5
is also present at MyApplication:library:unspecified:17:8 value=(@drawable/icon)
Suggestion: add 'tools:replace="android:icon"' to <application> element at AndroidManifest.xml:18:4 to override
这样可以在app的AndroidManifest.xml中做如下处理:
在manifest节点增加:
xmlns:tools="http://schemas.android.com/tools"
在application节点下增加
tools:replace="android:icon, android:theme"
替换覆盖icon、 theme处理
比如2:
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:6:5-25:19 to override.
这样可以在app的AndroidManifest.xml中做如下处理:
在manifest节点增加:
xmlns:tools="http://schemas.android.com/tools"
在application节点下增加
tools:replace="android:appComponentFactory"
android:appComponentFactory="任意字符" //两行都需要
替换覆盖appComponentFactory处理