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 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在合并上的解释

你可能感兴趣的:(Android-Studio uggestion: add 'tools:replace="android:icon")