情况是这样子的,导入一个比较老的项目(两年前),它依赖于一个 Libraray,已经先导入了 library,现在导入项目的时候出了错

(1) Android Studio 目前提供将 SDK包成 .aar 档案格式的方式,此方式除了将 class 包入之外,也会将资源、图片等,都一起包入。而以前所使用的 .jar 只会将相关的 class 包入,所以在以前将资源文件一起导入有时候会出问题

(2) 所有的资源文件会被 merge 在一起,什么意思呢?就是如果你自己做的SDK中包了一個 layout 叫做 abc.xml,當有个 project 使用你的SDK,而且这个 project 也有一个 layout/abc.xml,在将你的 SDK include 到 project 以后,build 的过程中,SDK中的abc.xml會和 project 中的abc.xml合并(或是取代)。

(3) 因为(2)的原因,所有的 resource file name 或是 resource id 都记得加上 prefix 或是 postfix,用 darkwing_co_abc.xml 或是 abc_darkwing_co.xml 的方式命名。不会因为合并或取代造成未知的错误。

(4) 有时候在编译的时候,遇到 attribute 重复的情况会回报错误,eg:

Error:Execution failed for task ':app:processDebugManifest'.
> Manifest merger failed : Attribute application@icon value=(@mipmap/ic_launcher) from AndroidManifest.xml:10: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:8:5-22:19 to override

这是因为 manifeast file 中某些 attribute 与 project 中的 minifeast 的 attribute 有重复,像是上面的例子,是说这两个地方都有 ic_launcher,所以编译器不知道用哪一个

这个时候可以指定下面的方式让编译器知道:
tools:replace=”android:icon,android:theme”

<?xml version="1.0" encoding="utf-8"?>
<manifest
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="co.darkwing.bookingapp" >
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme_darkwing_co"
tools:replace="android:icon,android:theme">
<activity
android:name=".MainActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>

注意, attribute 报错时候,什么报错就替换什么,我的 Theme 也报错了,替换之后无效,我就直接去掉一些Activity 的Theme,然后成功运行

原文:https://blog.csdn.net/u011033906/article/details/59577340

Manifest merger failed : Attribute application@icon value=(@mipmap/ic_launcher) from AndroidManifest的更多相关文章

  1. gradlew 命令行 build 调试 构建错误 Manifest merger failed MD

    Markdown版本笔记 我的GitHub首页 我的博客 我的微信 我的邮箱 MyAndroidBlogs baiqiantao baiqiantao bqt20094 baiqiantao@sina ...

  2. AS报:Manifest merger failed with multiple errors, see logs

    * What went wrong:Execution failed for task ':app:processDebugManifest'. Manifest merger failed with ...

  3. > Manifest merger failed with multiple errors, see logs -- Android Studio问题汇总

    FAQ:> Manifest merger failed with multiple errors, see logs 解决: 此问题产生原因大概有三个 # 第一,清单文件有错,这种错不会在编译 ...

  4. 终极报错解决方案:Error:Execution failed for task ':app:processDebugManifest'. > Manifest merger failed with

    遇到这个报错的时候,不要慌 Error:Execution failed for task ':app:processDebugManifest'. > Manifest merger fail ...

  5. Manifest merger failed : uses-sdk:minSdkVersion 9 cannot be smaller than version 10 declared in library

    Error:Execution failed for task ':app:processDebugManifest'. > Manifest merger failed : uses-sdk: ...

  6. 错误:“Manifest merger failed with multiple errors, see logs”

    今天用Android Studio打开以前写个的项目后,出现如下错误:Manifest merger failed with multiple errors, see logs 现象是:  遇到这个问 ...

  7. 解决『Manifest merger failed with multiple errors, see 』

    Error:Execution failed for task ':app:processDebugManifest'.> Manifest merger failed with multipl ...

  8. android studio - Manifest merger failed with multiple errors, see logs

    今天编译运行的时候遇到了“Error:Execution failed for task ':test:processDebugManifest'.> Manifest merger faile ...

  9. android开发里跳过的坑——android studio 错误Error:Execution failed for task ':processDebugManifest'. > Manifest merger failed with multiple errors, see logs

    使用AS在gradle里配置了多个定制版本,发现在编译版本切换时,会出现错误: Error:Execution failed for task ':processDebugManifest'.> ...

随机推荐

  1. [开源]基于Log4Net简单实现KafkaAppender

    背景 基于之前基于Log4Net本地日志服务简单实现 实现本地日志服务,但是随着项目开发演进,本地日志服务满足不了需求,譬如在预发布环境或者生产环境,不可能让开发人员登录查看本地日志文件分析. Kaf ...

  2. RDIFramework.NET V3.3 Web版新增报表管理功能模块-重量级实用功能

    功能描述 在RDIFramework.NET V3.3 Web版本新增了全新的报表管理功能模块,非常实用的功能,重量级推荐.主要用于对日常常用的报表做定制展示.可以自动发布到模块(就可授权给指定资源访 ...

  3. 2.5配置的框架浅析「深入浅出ASP.NET Core系列」

    希望给你3-5分钟的碎片化学习,可能是坐地铁.等公交,积少成多,水滴石穿,谢谢关注. 配置的使用流程 //第一步.初始化Builder var builder = new ConfigurationB ...

  4. Java使用Aspose组件进行多文档间的转换操作

    首先,祝大家新年快乐,2019诸事顺利,很久没有更新博客,今天要给大家说的是 ”Aspose“ 组件,作为2019年第一篇博客,希望大家能够多多支持,2019年要继续加油. 什么是Aspose? As ...

  5. 从官方文档去学习之FreeMarker

    一.前言 上一篇 <从现在开始,试着学会用官方文档去学习一个技术框架>提倡大家多去从官方文档学习技术,没有讲到具体的实践,本篇就拿一个案例具体的说一说,就是FreeMarker,选择这个框 ...

  6. sql:常用函数

    1.验证是否是null,是则替换ISNULL(Weight, 50) SELECT AVG(ISNULL(Weight, 50))FROM Production.Product; 2.连接多个字符串  ...

  7. function string类型的参数传递

    1.错误案例: Index:1 Uncaught ReferenceError: 系统管理 is not defined at HTMLAnchorElement.onclick (Index:1) ...

  8. vue-router 用户登陆

    有些路由页面需要用户登陆之后才能访问如(用户中心),如果用户没有登陆就访问这些页面的话就应该转换到登陆页面,登陆成功之后在进入该页面. 需要用到的知识点有:H5中的会话存储(sessionStorag ...

  9. noi.ac#309 Mas的童年(子集乱搞)

    题意 题目链接 Sol 记\(s_i\)表示前\(i\)个数的前缀异或和,我们每次相当于要找一个\(j\)满足\(0 < j < i\)且\((s_i \oplus s_j) + s_j\ ...

  10. pthread小结

    参考1 https://computing.llnl.gov/tutorials/pthreads/ 参考2 http://man7.org/linux/man-pages/man7/pthreads ...