Android-Studio uggestion: add 'tools:replace="android:icon"

错误情况:Error:Execution failed for task ':app:processDebugManifest'.

Manifest merger failed : Attribute application@icon value=(@mipmap/ic_launcher) from AndroidManifest.xml:8:9-43
is also present at [com.pnikosis:materialish-progress:1.0] AndroidManifest.xml:13:9-45 value=(@drawable/ic_launcher).
Suggestion: add 'tools:replace="android:icon"' to <application> element at AndroidManifest.xml:5:5-20:19 to override.

原因:AS在Gradle插件默认会启用Manifest Merger Tool ,若引入的Library项目中也有与当前项目具有相同的属性,则会合并失败,并报出类似上面的错误。本次错误是因为引入了 compile 'cn.pedant.sweetalert:library:1.3' 该引入中具有与本项目相同的项目图标值 android:roundIcon="@mipmap/ic_launcher_round" 而导致与本项目的 android:icon="@mipmap/ic_launcher" 原始图标产生冲突,合并失败。

解决方式:在Manifest.xml的application中添加tool:replace="android:icon"
在manifest中引入 xmlns:tool="http://schemas.android.com/tools"
即可解决

也可自行参考官方文档:http://tools.android.com/tech-docs/new-build-system/user-guide/manifest-merger 关于manifest在合并上的解释

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

友情链接更多精彩内容