本文介绍了必须声明清单元素的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

此错误发生在mipmap-anydpi-v26目录中的ic_launcher.xml文件中,即使我尝试更改其位置也无法解决.

This error occurs in ic_launcher.xml file that located in mipmap-anydpi-v26 directory and I can not solve it even I tried to change its location.

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.robpercival.listviewdemo">

<application android:allowBackup="true"
             android:icon="@mipmap/ic_launcher"/>


</manifest >

RelativeLayout和菜单元素也会发生类似的问题,我通过从可绘制目录中删除ic_launcher文件并在菜单和布局目录中创建新文件来解决这些问题.我不确定,但是当android studio版本更新到3.5时,也许会发生这些问题.

similar problems occur with RelativeLayout and menu elements and I solve them by deleting ic_launcher files from drawable directory and creating new files in menu and layout directories. I am not sure but maybe these problems happen when android studio version is updated to 3.5.

推荐答案

问题是您要删除"ic_launcher"文件格式的可绘制文件夹以解决RelativeLayout菜单元素问题,

Problem is you delete 'ic_launcher' file form drawable folder to solve RelativeLayout menu element problem,

,但是此文件链接到mipmap文件夹中的/mipmap/ic_launcher/ic_launcher.xml /mipmap/ic_launcher_round/ic_launcher_round.xml 文件中.

but this file is linked in /mipmap/ic_launcher/ic_launcher.xml and /mipmap/ic_launcher_round/ic_launcher_round.xml file in mipmap folder.

<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
   <background android:drawable="@drawable/ic_launcher_background" />
   <foreground android:drawable="@drawable/ic_launcher_foreground" />
</adaptive-icon>

仅删除2个文件

/mipmap/ic_launcher/ic_launcher.xml(anydpi-26)

/mipmap/ic_launcher/ic_launcher.xml(anydpi-26)

/mipmap/ic_launcher_round/ic_launcher_round.xml(anydpi-26)

/mipmap/ic_launcher_round/ic_launcher_round.xml(anydpi-26)

将ic_launcher_round(xxxhdpi)复制到可绘制的文件夹中.

Copy ic_launcher_round(xxxhdpi) to drawable folder.

和编辑

/mipmap/ic_launcher/ic_launcher.xml(anydpi-26)

/mipmap/ic_launcher/ic_launcher.xml(anydpi-26)

/mipmap/ic_launcher_round/ic_launcher_round.xml(anydpi-26)

/mipmap/ic_launcher_round/ic_launcher_round.xml(anydpi-26)

像这样

<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
  <background android:drawable="@drawable/ic_launcher_round" />
  <foreground android:drawable="@drawable/ic_launcher_round" />
</adaptive-icon>

这篇关于必须声明清单元素的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-04 14:02