Manifest merger failed
异常信息
Error:Execution failed for task ':module-user:processDebugManifest'.
> Manifest merger failed : Attribute application@label value=(组件模块:User) from AndroidManifest.xml:8:9-29
is also present at [com.itsdf07:lib-alog:2.0.2] AndroidManifest.xml:11:9-41 value=(@string/app_name).
Suggestion: add 'tools:replace="android:label"' to <application> element at AndroidManifest.xml:5:5-17:19 to override.
原因分析
项目这边我依赖的第三方库com.itsdf07:lib-alog:2.0.2
在编译时AndroidManifest.xml
中的属性合并出现了冲突Manifest merger failed
解决方案一
从日志中的提示,这边建议的解决方案是
Suggestion: add 'tools:replace="android:label"' to <application> element at AndroidManifest.xml:5:5-17:19 to override.
其中
tools:replace
是依赖库属性冲突解决方案
当项目中依赖了其他第三方库时,若该第三方库中的组件属性与本地库发生了冲突,通过 tools:replace
可以实现被 tools:replace
声明的组件会覆盖第三方库中的属性,如果冲突的属性是多个,则用 ,
隔开,如tools:replace="android:label,android:theme"
解决方案二
该方案则受限于这个第三方库是你自己的
如果属性不是必需在封装库中定义的,那么干脆就不要了,直接留给使用者自行定义,所以方案二我这边干脆直接把整个
application
标签移除掉