Suggestion: add 'tools:replace="android:icon"' to element
来源:互联网 发布:淘宝代购假货店铺名单 编辑:程序博客网 时间:2024/06/05 09:09
Suggestion: add 'tools:replace="android:icon"' to element
背景:
今天在用Android Studio开发时,遇到一个问题,建了一个项目,依赖了一个自己写的库,在编译时报了这个错误,大致的原因是资源与库在清单文件里引用了相同的资源文件,Gradle插件默认会启用Manifest Merger Tool,就会发生冲突。
错误提示:
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”,如下:
1 0
- Suggestion: add 'tools:replace="android:icon"' to element
- Suggestion: add 'tools:replace="android:icon"' to <application> element at AndroidManifest.xml
- Suggestion: add 'tools:replace="android:icon"' to <application> element at AndroidManifest.xml
- Suggestion: add 'tools:replace="android:icon"' to <application> element at AndroidManifest.xml
- Suggestion: add 'tools:replace="android:icon"' to <application> element at AndroidManifest.xml
- Suggestion: add 'tools:replace="android:allowBackup"' to <application> element at AndroidManifest.xm
- Suggestion: add 'tools:replace="android:label"' to <application> element at AndroidManifest.xml:28:5
- Manifest merger failed Suggestion: add 'tools:replace=“Android:value”' to <meta-data> element at And
- Suggestion: add 'tools:replace="android:value"' to <meta-data> element 报错解决方案
- Suggestion: add 'tools:replace="android:label"'
- Suggestion: add 'tools:replace="android:value"' to <meta-data> element at AndroidManifest.xml:25:5-2
- Suggestion: add 'tools:replace="android:value"' to <meta-data> element at AndroidManifest.xml:25:5-2
- Suggestion: add 'tools:replace="android:value"' to <meta-data> element at AndroidManifest.xml:25:5-2
- Suggestion: add 'tools:replace="android:value"' to <meta-data> element at AndroidManifest.xml:22:5-2
- add 'tools:replace="android:value"' to <meta-data> element问题的解决
- 使用Android Studio时报错 Manifest merger failed...Suggestion: add 'tools:replace="android:label"'
- add 'tools:replace="android:value"' to <meta-data> element at AndroidManifest.xml:25:5-27:34 to over
- tools:replace="android:icon, android:theme"
- Firebug控制台调试程序
- @NotNull、@NotEmpty、@NotBlank的区别
- Printers(一) 打印机配置信息
- 飞机大战整理
- 深入研究SSL【第二章 part-2】-SSL握手协议的研究
- Suggestion: add 'tools:replace="android:icon"' to element
- 使用splice删除数组时,需要注意的地方
- Swiper常用于移动端网站的内容触摸滑动
- SVN和Git项目管理中-tag操作步骤
- DOM操作
- C++的try_catch异常
- 通讯系统经验谈解读内核参数 - socket/文件句柄资源限制参数
- mybatis 入门实例
- log4j.propertise文件配置