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
標籤移除掉