首页 分享 Attribute application@icon value=(@mipmap/ic

Attribute application@icon value=(@mipmap/ic

来源:花匠小妙招 时间:2024-09-18 22:49

情况是这样子的,导入一个比较老的项目(两年前),它依赖于一个 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

相关知识

xml 属性value换行显示
详解CSS属性选择器
ssm框架鲜花完整项目前台后台实现包含sql
花卉识别数据图片花卉数据图片
FlowersRecognition(花卉识别数据集).zip
Evaluation of insect pollination and service value in China's agricultural ecosystems
js上传文件带参数,并且,返回给前台文件路径,解析上传的xml文件,存储到数据库中
这个花电出售各种各样的进口花卉 的翻译是:正在翻译,请等待... 中文翻译英文意思,翻译英语
Effect of biological soil crust on photographically measured value of vegetation coverage
东莞花店厂家

网址: Attribute application@icon value=(@mipmap/ic https://www.huajiangbk.com/newsview178495.html

所属分类:花卉
上一篇: 实验一:鸢尾花数据集分类
下一篇: 林下花卉有哪些品种

推荐分享