情况是这样子的,导入一个比较老的项目(两年前),它依赖于一个 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. TabTopUnderLineLayout【自定义顶部选项卡(带下划线)】

    版权声明:本文为HaiyuKing原创文章,转载请注明出处! 前言 自定义顶部选项卡布局LinearLayout类,实现带下划线样式的效果. 备注:如果配合Fragment的话,MainActivit ...

  2. C#委托、事件、线程

    这是几个简单的例子,但是实际的开发中委托还还只在反射时用到过,事件的话只自己做了一次,并且还是特意去用的 ,实际上可以不用.线程的话,因为需要,所以用的会多点,这里主要是WS上的线程. 委托 在前面的 ...

  3. 深度学习之卷积神经网络(CNN)详解与代码实现(二)

    用Tensorflow实现卷积神经网络(CNN) 本文系作者原创,转载请注明出处:https://www.cnblogs.com/further-further-further/p/10737065. ...

  4. Chrome - JavaScript调试技巧总结(浏览器调试JS)

    Chrome 是 Google 出品的一款非常优秀的浏览器,其内置了开发者工具(Windows 系统中按下 F12 即可开启),可以让我们方便地对 JavaScript 代码进行调试. 为方便大家学习 ...

  5. 你的响应阻塞了没有?--Spring-WebFlux源码分析

    1. Spring WebFlux是什么? Spring WebFlux是Spring Framework 5.0中引入的新的反应式Web框架. 与Spring MVC不同,它不需要Servlet A ...

  6. SpringCloud学习中遇到的一些bug

    There was a problem with the instance info replicator 错误原因: 该服务尝试将自己作为客服端注册 解决办法: 在application.yml配置 ...

  7. 第一册:lesson 119.

    原文: A true story. question:Who called out to the thieves in the dark? Do you like stories? I want to ...

  8. css 椭圆样式

    <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...

  9. SharePoint中你不知道的图片库(实战)

    分享人:广州华软 无名 一. 前言 以前,在门户网站放一个图片幻灯片时,除了要自己开发实现外,还需要处理上传图片的大小,但在SharePoint中,使用图片库,无需花费时间和精力,就能马上实现. 二. ...

  10. OPPO K3在哪里打开USB调试模式的完美方法

    当我们使用pc链接安卓手机的时候,如果手机没有开启USB调试模式,pc则无法成功识别我们的手机,这个时候我们需要找解决方法将手机的USB调试模式打开,今天我们介绍OPPO K3如何开启USB调试模式的 ...