Suggestion: add 'tools:replace="android:icon"' to

Suggestion: add 'tools:replace="android:icon"' to element 背景: 今天在用Android Studio開發時,遇到一個問題,建了一個項目,依賴了一個本身寫的庫,在編譯時報了這個錯誤,大體的緣由是資源與庫在清單文件裏引用了相同的資源文件,Gradle插件默認會啓用Manifest Merger Tool,就會發生衝突。android

錯誤提示: Error:Execution failed for task ':loggertest:processDebugManifest'. Manifest merger failed : Attribute application@icon value=(@mipmap/iclauncher) from AndroidManifest.xml:7:9-43 is also present at [TuringOSLoggerAPI:app:unspecified] AndroidManifest.xml:16:9-45 value=(@drawable/iclauncher). Suggestion: add 'tools:replace="android:icon"' to element at AndroidManifest.xml:5:5-18:19 to override. 解決方法 將依賴庫中清單文件,引用的依賴庫的清單文件中的,衝突部分刪除掉,我這裏主要刪除了android:icon="@drawable/ic_launcher",刪除事後,編譯正常,程序編譯經過 根據IDE提示修改,首先在項目的清單文件的根標籤下引入xmlns:tools="http://schemas.android.com/tools",注意不是依賴庫的的清單文件裏,已測試不可行,以後在application裏的標籤里加入tools:replace="android:icon"以後從新build,便可經過編譯,theme問題一樣這樣解決:tools:replace=」android:icon, android:theme」,以下:app

相關文章
相關標籤/搜索